Home » excel » excel vba – .Value property on Range() in VBA

excel vba – .Value property on Range() in VBA

Posted by: admin April 23, 2020 Leave a comment


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

myX = Range("A1")

rather than

myX = Range("A1").Value

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?

How to&Answers:

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

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