VBA中Range()的.Value属性 [英] .Value property on Range() in VBA

查看:238
本文介绍了VBA中Range()的.Value属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过的一些Excel VBA代码没有在Range对象上使用.Value属性,例如:

Some Excel VBA code I've seen does not used the .Value property on the Range object, for example:

myX = Range("A1")

而不是

myX = Range("A1").Value

这仅仅是因为range对象的默认行为是返回单元格中的值吗?曾经有一段时间我想要使用此属性来访问单元格中的数值吗?

Is this just because the default behavior of the range object is to return the value in the cell? Is there ever a time when I would not want to use this property to access the numerical value in a cell?

推荐答案

值是Range的默认属性.因此,任何期望一个属性并单独引用一个Range的代码都将获得Value.

Value is the default property of Range. So any code that expects a property and refers to a Range alone, will get Value.

还有其他一些将返回范围的值"的属性,例如Value2,Text,有时甚至是Formula *,它们都有其特定的用途.

There are other properties that will return a range's "value" such as Value2, Text, and sometimes Formula* which have their specific uses.

这篇关于VBA中Range()的.Value属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆