Manish2233
New Member
- Joined
- Jul 31, 2022
- Messages
- 5
- Office Version
- 365
- Platform
- Windows
i want to repeat the recorded macro (repeat each steps) to all rows till blank cell in column I .
Below is my recorded macro and it works fine in S2, but not working down the line
Sub Macro5()
Dim I As Long
I = 2
Do Until Cells(I, 9) = ""
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-12],'Sheet3 (2)'!R2C1:R989C2,2,0)"
Range("S2").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AD2").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Sheet3 (2)").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A2:J2").Select
Application.CutCopyMode = False
Selection.Cut
Range("L2").Select
ActiveSheet.Paste
Range("M5").Select
Sheets("Allocation").Select
I = I + 1
Loop
End Sub
Below is my recorded macro and it works fine in S2, but not working down the line
Sub Macro5()
Dim I As Long
I = 2
Do Until Cells(I, 9) = ""
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-12],'Sheet3 (2)'!R2C1:R989C2,2,0)"
Range("S2").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AD2").Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Sheet3 (2)").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A2:J2").Select
Application.CutCopyMode = False
Selection.Cut
Range("L2").Select
ActiveSheet.Paste
Range("M5").Select
Sheets("Allocation").Select
I = I + 1
Loop
End Sub