Macro to Move Multiple Rows below their corresponding rows to the left

InvExcel

New Member
Joined
Jul 6, 2011
Messages
1
Hello - I am suck on the file step of a macro and to be honest I don't have much experience with macros so I am surprised I even made it to the file step.

I have a worksheet of data that contains 1000 rows - starting at row 1 and starts at column A and ends at column W. However, the data from M:W needs to be inserted in a new row directly below A:L. And it needs to continue for all existing rows. I have created a macro to insert a blank row so I am trying to figure out how to efficiently move the data - something like creating a loop and I am jsut not sur ewhat to do.

Current Insert Row Macro:

Sub Insert_Blank_Rows()
'Select last row in worksheet.
Selection.End(xlDown).Select
Do Until ActiveCell.Row = 1
'Insert blank row.
ActiveCell.EntireRow.Insert shift:=xlDown
'Move up one row.
ActiveCell.Offset(-1, 0).Select
Loop
End Sub


I know I can create a macro like this - which would take forever to create:

Range("M1:W1").Select<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Selection.Cut Destination:=Range("A2:K2")<o:p></o:p>
Range("M3:W3").Select<o:p></o:p>
Selection.Cut Destination:=Range("A4:K4")<o:p></o:p>
Range("M5:W5").Select

OR something like this if I don't use the Insert a row macro:
<o:p></o:p>
<o:p>Rows("2:2").Select
Application.CutCopyMode = False
Selection.Insert shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("M1:W1").Select
ActiveWindow.SmallScroll ToRight:=-9
Selection.Cut Destination:=Range("A2:K2")
Rows("4:4").Select
Selection.Insert shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("M3:W3").Select
Selection.Cut Destination:=Range("A4:K4")
Range("A4:K4").Select</o:p>
Help!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,224,569
Messages
6,179,605
Members
452,928
Latest member
VinceG

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