I need to create a simple macro to clean my worksheets. Basically, if there are multiple orders on 1 shipment, I need those orders to be displayed vertically instead of horizontally example:
I created a macro that will copy/paste the 1st row into the row below it and then change the 2nd order with another copy/paste.
Pretty simple. My problem is the macro is binded to the ranges I created the macro in.
How can I make it so I can run this macro on selected ranges. Rather than manually copy and pasting every row with multiple orders, I'd rather highlight the rows with multiple orders and run the macro.
This is the code:
ActiveCell.Range("A1:M1").Select
Selection.Copy
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown
ActiveCell.Offset(0, 3).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(-1, 1).Range("A1:A2").Select
Application.CutCopyMode = False
Selection.ClearContents