I am trying to take the 2999'th value for the B column and the C column and place them in D1 and E1... then go to 2999*2 for D2 and E2, etc. Below is the code I have.
Sub Macro1()
Dim Counter As Integer
Dim Y As Integer
Counter = 1
Y = Counter * 2999
If (Counter < 5) Then
Range("E1".Select
ActiveCell.FormulaR1C1 = "=R[$Y]C[-2]"
Range("F1".Select
ActiveCell.FormulaR1C1 = "=R[$Y]C[-4]"
Counter = Counter + 1
Else
End If
End Sub
I am getting a debug error on the ActiveCell.FormulaR1C1 = "=R[$Y]C[-2]" line, I know its with the $Y part, I've tried multiple things... how do I make the [] equal to what Y is? Also, how do I make the loop repeat until it's run out've data lines? Thanks!
Sub Macro1()
Dim Counter As Integer
Dim Y As Integer
Counter = 1
Y = Counter * 2999
If (Counter < 5) Then
Range("E1".Select
ActiveCell.FormulaR1C1 = "=R[$Y]C[-2]"
Range("F1".Select
ActiveCell.FormulaR1C1 = "=R[$Y]C[-4]"
Counter = Counter + 1
Else
End If
End Sub
I am getting a debug error on the ActiveCell.FormulaR1C1 = "=R[$Y]C[-2]" line, I know its with the $Y part, I've tried multiple things... how do I make the [] equal to what Y is? Also, how do I make the loop repeat until it's run out've data lines? Thanks!