View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default When do you need .Value?

Value is the default property of the Range object.

Just for discussion, here is a copy from vba's help on "Cells Property"

<..copy
Remarks:
Because the Item property is the default property for the Range object, ...
<..end copy

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Dick Kusleika" wrote in message
...
All,

Value is the default property of the Range object. Item is the default
property of the Cells property which returns a Range object. That's why
Range("A1") = Range("a1").Value is True and Cells(1,2) = Cells.Item(1,2)

is
True. There is no cell object.

I'm curious why omitting the Value property would be more efficient. I
would think the opposite. If I don't include it, the VBA has to figure

out
what type of object I'm using, look up its default property and process

from
there. If I don't omit it, there's no lookup. I don't have any real
evidence of this, it's just what I think would happen.

FWIW, I also include every default property. But I'm willing to learn.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com



Alan Beban wrote:
I'm not sure what difference it makes, but I think the default property
for a Range Object, including ranges that are cells, is the Item

Property.

Alan Beban

SunTzuComm wrote:

Each object has a default property, and for cell objects, it's

".Value".
I wouldn't trust myself to remember the default property of every
object, but if you know one for sure, you can safely omit it. In fact,
doing so may make the code more efficient.

Regards,
Wes