Variables in Macros

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I am working with a macro and a loop function. Is there
a way to use a variable in a formula. I know how to
incriment the cells with variables but the formula that I
put in each cell needs to change depending on how long
the loop goes. Thanks for any ideas or help.

Dan
 
Hi Dan
Dim n As Long
For n = 1 To 10 'or whatever
Rng1 = Cells(n, 1).Address
Cells(n, 2).Formula = "=" & Rng1
Next n

HTH
Cordially
Pascal
 
Back
Top