Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Row increments change by 1 after each For...Loop 1

Status
Not open for further replies.

1sheepdog

Programmer
Nov 18, 2005
2
US
Hi,
I have a list of loans that I am running cash flows on and trying to go row by row for each loan in Excel. Here's what I have so far:

For i = 1 To 100
Range("X1").Select
ActiveCell.FormulaR1C1 = "=+R[1]C[-10]"
Range("X2").Select
ActiveCell.FormulaR1C1 = "=+R[2]C[-9]"
Next i
End Sub


How can I incrementally change by 1 the row number from 1 to 2, 2 to 3,etc. ("R[1]" to "R[2]") after each For . . Loop of commands is run? I tried the obvious "R[1+i]" which resulted in a Runtime 1004 error.

Much obliged - thanks.
 
Try this

"=+R[" & i & "]C[-10]"



Thanks and best regards,
-Lloyd
 
How are X1 and X2 related to i ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
1sheepdog,

What are you trying to do?

With the code you posted, all you would do is change the formula in X1 and X2 100 times, but in the end what purpose is served?

[tt]_____
[blue]-John[/blue][/tt]

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top