View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Selecting a defined Name via a cell's contents

As far as VBA's concerned, there's no particular advantage or
disadvantage to either. Topper's suggestion is obviously shorter.

I try to be explicit with the properties I reference. The .Value
property is the default property for the Range object, so

Dim a As Double
a = Range("A2")

and

Dim a As Double
a = Range("A2").Value

are equivalent - the context implies that the .Value property is what is
being referred to in the first example, not the object itself. I find
that making the property explicit helps make the code more readable and
maintainable.

YMMV.



In article ,
"PCLIVE" wrote:

Is there
any advantage or disadvantage between your suggested method and Toppers
suggestion?

Toppers' suggestion: Range(Range("A2")).select
Your suggestion: Range(Range("A2").Value).Select

There both very similar and seem to work. Does ".Value" give any added
accuracy or stability, or is it just another way to write it.