Hi Everyone,
I have a macro that inserts a new line under certain conditions (where "RAN" is shown)
The problem I have is that it works perfectly for the first 46 rows but will not work thereafter.
Can anyone help and advise where the issue is?
Thanks
Heres the code:-
Option Explicit
Sub new_inspection()
Dim lrow As Long, i As Long
With Worksheets("Sheet1")
lrow = .Range("A" & .Rows.Count).End(xlUp).Row
For i = 2 To lrow
If .Range("W" & i).Value = "RAN" Then
.Rows(i + 1).Insert
.Range("A" & i & ":R" & i).Copy .Range("A" & i + 1)
.Range("R" & i + 1).Value = "7G"
.Range("W" & i + 1).Value = "RAN"
i = i + 1
lrow = lrow + 1000
End If
Next i
End With
End Sub
Bookmarks