I'm looking for a macro in insert rows. I'm trying to insert the following:
1. One row above Row 1
2. Three rows below Row 1
3. Three Rows below Row 51.
I tried this, but SOMETIMES, not always, it just inserts 5 rows above Row 1
So then I broke it down into 3 Macros, thinking that it was getting confused with going above Row 1 and then again above Row 2
The idea behind this was to let it finish inserting the first group before inserting the second, but it didn't work. It still works one way sometimes and the other way others.
1. One row above Row 1
2. Three rows below Row 1
3. Three Rows below Row 51.
I tried this, but SOMETIMES, not always, it just inserts 5 rows above Row 1
VBA Code:
Sub MarchInsertRows1()
Worksheets("Weekdays").Activate
Rows("1:1").Select
Rows("2:4").Select
Rows("52:54").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Worksheets("Buttons").Activate
End Sub
So then I broke it down into 3 Macros, thinking that it was getting confused with going above Row 1 and then again above Row 2
VBA Code:
Sub MarchInsertRows1()
Worksheets("Weekdays").Activate
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Worksheets("Buttons").Activate
End Sub
Sub MarchInsertRows35()
Worksheets("Weekdays").Activate
Rows("3:5").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Worksheets("Buttons").Activate
End Sub
Sub MarchInsertRows5658()
Worksheets("Weekdays").Activate
Rows("56:58").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Worksheets("Buttons").Activate
End Sub
Sub MarchInsertRows()
Call MarchInsertRows1
Call MarchInsertRows35
CallMarchInsertRows5658
End Sub
The idea behind this was to let it finish inserting the first group before inserting the second, but it didn't work. It still works one way sometimes and the other way others.