Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
assigning variables
I have a problem that's new to me. I have a column, say B2 through B15.
There aare names in say the first 8 cells. Elsewhere in the code, I do things with these names; for example I sort these names. Sometimes the number of names will change. I may have 8 cells with names, and I will need to change this to 7 cells with names or 9 cells with names. Because the number of cells with names changes sometimes, and this reference is used in a number of places in macros and VBA, I would like to assign a variable to the number of cells, i.e. (variable 'a' = cells B2 thru B9), and then use this variable insteal of the cell references. This way, if I have to add or delete a name from the cells, I only have to do it in one place. Any suggestions? Thanks, Howard -- Howard |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
assigning variables
LastRow = Range("B" & rows.count).end(xlup).row Set MyRange = Range("B2:B" & LastRow) -- joel ------------------------------------------------------------------------ joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=198523 http://www.thecodecage.com/forumz |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Assigning cell values to variables | Excel Discussion (Misc queries) | |||
Assigning Variables To An array Throughout a loop | Excel Programming | |||
Assigning Cell data to VB Variables | Excel Programming | |||
Assigning multiple text strings to variables | Excel Programming | |||
Assigning cell address components to variables | Excel Programming |