View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Referencing variable in a loop

Sub TheBeesKnees()
Dim i As Long
Dim LR As Long
Dim G As Long
Dim A As Long
Dim LastRow As Long
A = 5
G = 10
LastRow = 15

For i = 1 To 100
LR = LastRow + i
Cells(LR, 1).Value = A + i - G + i
Next 'i
End Sub

Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"JeffMelton" wrote in message...
I don't know why I can't figure this out. I have a lot of variables
already defined A1, A2, A3 etc etc.

I'm running a loop and would like to call the needed variable like this

For i= 1 to 100
LR = Lastrow + i
Range("A"& LR) = A & i - G & i
next

is this not possible or something?