Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Referencing variable in a loop

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?

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

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
Variable cell referencing Paul Excel Worksheet Functions 1 February 16th 08 10:55 PM
Referencing tab based on Variable Chad Excel Worksheet Functions 2 June 8th 07 03:48 PM
Help with referencing variable range Cutter[_18_] Excel Programming 4 November 6th 05 12:38 AM
Referencing cells in a loop titi Excel Programming 0 May 19th 04 11:56 AM
Referencing variable Lee Excel Programming 1 December 4th 03 04:07 PM


All times are GMT +1. The time now is 10:53 PM.

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"