3

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?

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

3 Comments

When are the Value2, Text, and Formula properties returned as default value? I looked at the documentation of Range but no mention at all about default properties. Or is this standard VBA behaviour?
They are Never returned as default.
So I misunderstood ;-) I'm still wondering if it's not documented that Value is implicitly returned...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.