MurraySMTH
Board Regular
- Joined
- Jun 30, 2020
- Messages
- 81
- Office Version
- 2016
- Platform
- Windows
Hello all. I am using a loop code to add 7 rows in between rows.
The problem is I don't know how to account for the headers. Can someone take a look at my code. I want 7 rows in between each row that has data, but not in between the header and the first line of rows. So the blank rows would start at 3.
The problem is I don't know how to account for the headers. Can someone take a look at my code. I want 7 rows in between each row that has data, but not in between the header and the first line of rows. So the blank rows would start at 3.
VBA Code:
Sub AddRows()
ScreenUpdating = False
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Dim AddRows As Integer: AddRows = 7
Dim i As Integer: i = LastRow
Do While i <> 1
Rows(i & ":" & i + AddRows - 1).Insert
i = i - 1
Loop
ScreenUpdating = True
End Sub