Is “Value” actually the default property of the Range object?

The default member of the Range class is called _Default and is hidden. When you enable the “Show Hidden Members” feature in the Object Browser you can see it:

VBA Object Browser

It has the exact same signature as the .Item property, so one of them is arguably an alias for the other.(*)

In any case, Range also implements the collection interface. As such, it can be used in a For Each loop — and when you do that, the loop will call .Item with each iteration and assign the current item to the loop variable.

When used outside an enumeration, for example with Debug.Print, then .Value will be used, but I can’t really explain why. Maybe someone else can come up with a hint.(*)


(*) As @GSerg points out in the comments, _Default() and _Item() are not exactly equal.

Leave a Comment