Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Dim cell AS range....

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

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Dim cell AS range....

Hi
this code part is just the variable declaration. It tells VBA which
type of variable 'rng' or 'cell' are (you can replace these names with
whatever name you like)
Another example would be:
Dim Str as String

this tells VBA what Str is a string variable. You may take a look at
the following website to learn more about VBA:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Regards
Frank Kabel
Frankfurt, Germany

mike wrote:
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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Dim cell AS range....

Mike,

All that code is doing is defining three variables, all of range datatype.
In itself, it does nothing, each variable is nothing at that point, but
worksheets ranges can be loaded (set cell = Range("A1")) and then used in
any subsequent processing. AT this point they also have no relationship to
one another.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"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



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
Find Last cell in Range when range is date format default105 Excel Discussion (Misc queries) 5 July 7th 09 03:11 PM
RANGE EXCEL copy cell that meets criteria in a range confused Excel Worksheet Functions 3 March 27th 08 01:41 PM
copy range and paste into every 3rd cell of new range thomsonpa New Users to Excel 4 December 3rd 07 01:47 PM
Referencing a named range based upon Range name entry in cell Barb Reinhardt Excel Worksheet Functions 14 June 20th 07 07:19 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM


All times are GMT +1. The time now is 04:00 AM.

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

About Us

"It's about Microsoft Excel"