Variables in Macros

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
 
P

papou

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top