Hi all new to VBA,
Task: Insert a new row every 12th row starting at cell A14 with the text "NEG".
Problem: After running the macro it will miss the last NEG in the last set of data. Possibly due to the last row changing after the macro adds in new rows and pushing the data down?
Is there a way to work around this?
Code below I've been using found on this website.
Option Explicit
Sub Evry12()
Dim i As Long
Dim lr As Long
lr = Range("A" & Rows.Count).End(xlUp).Row
For i = 14 To lr
Range("A" & i).EntireRow.Insert
Range("A" & i) = "NEG"
i = i + 11
Next i
End Sub
Thanks,
Ed
Task: Insert a new row every 12th row starting at cell A14 with the text "NEG".
Problem: After running the macro it will miss the last NEG in the last set of data. Possibly due to the last row changing after the macro adds in new rows and pushing the data down?
Is there a way to work around this?
Code below I've been using found on this website.
Option Explicit
Sub Evry12()
Dim i As Long
Dim lr As Long
lr = Range("A" & Rows.Count).End(xlUp).Row
For i = 14 To lr
Range("A" & i).EntireRow.Insert
Range("A" & i) = "NEG"
i = i + 11
Next i
End Sub
Thanks,
Ed