#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 189
Default question in VB codes

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB Codes bowling Excel Discussion (Misc queries) 0 July 30th 07 07:02 PM
Help with codes please!! Nick TKA Excel Discussion (Misc queries) 0 April 28th 06 12:47 PM
ZIP CODES js42 Excel Worksheet Functions 2 August 5th 05 03:59 PM
Zip Codes Queen Excel Discussion (Misc queries) 3 February 18th 05 02:47 PM
Zip Codes [email protected] Excel Discussion (Misc queries) 10 November 27th 04 05:23 PM


All times are GMT +1. The time now is 01:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"