Create Loop Code - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Create Loop Code

frede123frede123 Posts: 1Member
Hey everybody, I want to create a code that does the same for all my 1300 firms in the sample. The problem is that some cells are supposed to stay the same, but that others are supposed to go down one row with every iteration.

[Code]
Sheets("Final Sample").Select
FinalRow = Selection.End(xlDown).row
For x = 2 To FinalRow
Sheets("Sheet1").Select
Range("F3").Select
ActiveCell.FormulaR1C1 = "=RC[-3]-'Final Sample'!r2c7+1"
Range("F3").Select
Selection.AutoFill Destination:=Range("F3:F63842")
Next x

End Sub
[/Code]

Where it says "r2c7" I need it to be r3c7 in the next iteration and so on, so that the cell reference goes down one rown every time. I thought of something like an x (rxc7), but I did not know the syntax. If that's not possible with an x, I am open to suggestions... It should be really easy right? Thank you in advance.

Sign In or Register to comment.