tjakatjs
11-29-2016, 05:45 AM
I need help creating a loop for this fairly simple code. I haven't included the actual spreadsheets as they are rather cumbersome but I think this is simple enough that someone should be able to help. Here's the code with the notes of what needs to be added/changed. Thank you in advance for your help.
Sheets("SA V.1").Select
Range("B22").Select
ActiveCell.FormulaR1C1 = "='MACD Table'!R[-21]C"
Do
'until column A is blank
Sheets("SA V.1").Select
Range("B21").Select
ActiveCell.FormulaR1C1 = "='MACD Table'!R[-19]C[-1]"
'I want this to move down a row each time the routine repeats
Range("B23").Select
Selection.Copy
Sheets("MACD Table").Select
Range("B2").Select
'This also needs to move down a row each time
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Loop Until IsEmpty(Cells(iRow, 1))
End Sub
Sheets("SA V.1").Select
Range("B22").Select
ActiveCell.FormulaR1C1 = "='MACD Table'!R[-21]C"
Do
'until column A is blank
Sheets("SA V.1").Select
Range("B21").Select
ActiveCell.FormulaR1C1 = "='MACD Table'!R[-19]C[-1]"
'I want this to move down a row each time the routine repeats
Range("B23").Select
Selection.Copy
Sheets("MACD Table").Select
Range("B2").Select
'This also needs to move down a row each time
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Loop Until IsEmpty(Cells(iRow, 1))
End Sub