baron11
11-24-2008, 12:57 PM
I have a simple VBA code
For period = 0 to 100 Step 10
Sheets("sheet1").Select
Range("A1").Select
ActiveCell.Formula= period
Sheets("sheet2").Select
Range ("B1").Select
ActiveCell.Formula="=Sheet1R5C5"
Next period
End period.
Basically, I change a variable in sheet1 cell A1 and that creates a new value for the formula output in cell E5. I paste this output in cell B1 on sheet2.
My question is, how do I work with the loop so that the next value of period in the loop gets posted in cell B2 and not B1 again.
Thanks a lot for your answer.
For period = 0 to 100 Step 10
Sheets("sheet1").Select
Range("A1").Select
ActiveCell.Formula= period
Sheets("sheet2").Select
Range ("B1").Select
ActiveCell.Formula="=Sheet1R5C5"
Next period
End period.
Basically, I change a variable in sheet1 cell A1 and that creates a new value for the formula output in cell E5. I paste this output in cell B1 on sheet2.
My question is, how do I work with the loop so that the next value of period in the loop gets posted in cell B2 and not B1 again.
Thanks a lot for your answer.