View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default question in VB codes

Those two statements are very different. The first statement creates a range
object that references cell C1. The second statement fills a variable with
the contents of cell C1.

The Set statement is used to create or modify objects. Basically telling
your sytem to point to an object like a range or a worksheet or workbook.
With that reference I can access all of the properties and methods of that
object.

Your second statement fills a variable with the contents of the cell. By
default a cell returns its value unless you specify otherwise.
--
HTH...

Jim Thomlinson


"peyman" wrote:

hi,
is there any difference between these two codes?
for example:
set curCell=sheets("sheet1").cells(1,3)
and
curCell=sheets("sheet1").cells(1,3)
I'd like to know why sometimes "set" is used at the beginning of codes?
thanks