Hi All,
I'm trying to add 5 rows after the word "Aaron" is found in a sheet.
I found the macro below but it only adds 1 row - how can I change this to add 5.
Thanks, Aaron.
Sub test()
Dim iLastRow As Long
Dim i As Long
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = iLastRow To 1 Step -1
If Cells(i, "A").Value = "Aaron" Then
Rows(i + 1).Insert
End If
Next i
End Sub
I'm trying to add 5 rows after the word "Aaron" is found in a sheet.
I found the macro below but it only adds 1 row - how can I change this to add 5.
Thanks, Aaron.
Sub test()
Dim iLastRow As Long
Dim i As Long
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = iLastRow To 1 Step -1
If Cells(i, "A").Value = "Aaron" Then
Rows(i + 1).Insert
End If
Next i
End Sub