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-comfficeffice" /><o></o>
Selection.Cut Destination:=Range("A2:K2")<o></o>
Range("M3:W3").Select<o></o>
Selection.Cut Destination:=Range("A4:K4")<o></o>
Range("M5:W5").Select
OR something like this if I don't use the Insert a row macro:
<o></o>
<o>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>
Help!
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-comfficeffice" /><o></o>
Selection.Cut Destination:=Range("A2:K2")<o></o>
Range("M3:W3").Select<o></o>
Selection.Cut Destination:=Range("A4:K4")<o></o>
Range("M5:W5").Select
OR something like this if I don't use the Insert a row macro:
<o></o>
<o>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>
Help!