View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Dim cell AS range....

Mike,

All that code is doing is declaring three variables as Range type
objects. These variables don't refer to any range or cell in
particular. They can be set to a specific cell or range of cells
with the Set command. For example,

Dim Rng1 As Range
Dim Rng2 As Range
Set Rng1 = Range("A1")
Set Rng2 = Cells.Find("abc")

If you attempt to use any of the variables without initializing
them with a Set command, you'll receive an error 91 - Object
Variable Not Set. Unless you specifically set the variable to a
particular range, it doesn't refer to any range. There is
nothing automatic going on.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"mike" wrote in message
...
I would like to understand this..lets see if i understand
what it is telling vb to do.

...
Dim cell As Range, rng AS Range
Dim rng1 As Range
...

this is part of the whole code i have but i was thinking
of this part...
Does this mean that it is setting a "cell" as a range in
the whole workbook and when it sees what it is looking
for in that cell then that cell is referred to as rng1
for the moment?
can anyone clarify and tell me if i am close or in the
outfield?

mike