When and Why to use Set X = Y

D

Dennis

Using XL 2003

Noticed different techniques to "energize" a variable, ie:

X = Y+2

Set X = Y.Z

Could someone please explain or point me to an explanation of these
different techniques.

I do realize that they are not the same but I do not know why and when to
use them.

TIA Dennis
 
B

Bob Phillips

Set is used when creating an object variable, such as a worksheet or a
range, e.g.

Set mySheet = Activesheet
or
Set myRange = Activesheet.Range("A1:A10")

you can then manipulate this object in your code.

The other form just sets that variable to the value.
 
D

Dennis

Thanks Bob

Bob Phillips said:
Set is used when creating an object variable, such as a worksheet or a
range, e.g.

Set mySheet = Activesheet
or
Set myRange = Activesheet.Range("A1:A10")

you can then manipulate this object in your code.

The other form just sets that variable to the value.

--

HTH

RP
 
Top