Noob question time.
I've noticed looking through here that sometimes 'Set' is used with a variable and other times it isn't. Is there a proper time and place to use 'Set'? When should I use/not use it?
Noob question time.
I've noticed looking through here that sometimes 'Set' is used with a variable and other times it isn't. Is there a proper time and place to use 'Set'? When should I use/not use it?
In Visual Basic Editor
Type Set then press F1 to get full details of the Set command
Set - Assigns an object reference to a variable.
example - assign a worksheet to a varaible
set wS = Workbook("Book1").Sheets("Sheet1")
allows you to refer to (work with) the worksheet directly
eg ws.Range("a1")
You will also need to understand what an Object is.
In Visual Basic Editor - Type Object then press F1 to get full details of the Set command
Object variables are stored as 32-bit (4-byte) addresses that refer to objects. Using the Set statement, a variable declared as an Object can have any object reference assigned to it.
Hi Mark,Originally Posted by Mark K
Here is some additional info.
http://www.excelforum.com/showthread.php?t=572376
Last edited by Desert Piranha; 08-31-2006 at 01:49 PM. Reason: Spelling
Thx
Dave
"The game is afoot Watson"
Thanks, will look into them.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks