If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Variable cell refernces

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-30-06, 22:49
aboo aboo is offline
Registered User
 
Join Date: May 2006
Posts: 178
Variable cell refernces

Hey guys,

Is it possible to have a variable cell references? for example in a loop

where i = 2 TO 50

then have a cell reference as B(i)

is this possible?

Thanks

aboo
Reply With Quote
  #2 (permalink)  
Old 05-31-06, 00:33
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Howdy, and welcome to the board.

Yes that is possible, but you may want to include two variables (row and col). There are a couple of ways to do it, but the easiest way is to use Cells. In the following, it is not exactly correct, but you get the idea. If you want the double refernce (Row and Col), then use another For lngCol 2 to 50 statement inside the one below.

Code:
Dim lngRow as Long, lngCol as Long
For lngRow 2 to 50
   Cells(lngRow,lngCol)
Next lngRow
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #3 (permalink)  
Old 05-31-06, 09:29
aboo aboo is offline
Registered User
 
Join Date: May 2006
Posts: 178
Thankyou for your welcome and for your reply. Im going to be buggin you alot.

Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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