Recorded Macro To apply in all column

Manish2233

New Member
Joined
Jul 31, 2022
Messages
5
Office Version
  1. 365
Platform
  1. 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
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
i want to repeat the recorded macro (repeat each steps in column S) to all cell in column S 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
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top