Hello JP16,
To delete rows using a loop you need to work from the bottom up
Also, remove the counter (i = i - 1) as it is contradicting the Next i function.
So your code should look like this:-
Sub del()
Dim lr As Long, i As Integer
lr = Cells(Rows.Count, 1).End(xlUp).Row
For i = lr To 1 Step -1 '--------> From the lr up to the top. Step -1 will "catch" the next _
row with a blank cell in Column A as the rows move up when deleted.
If Cells(i, 1) = "" Then
Rows(i).Delete
End If
Next i
End Sub
I hope that this helps.
Cheerio,
vcoolio.
Bookmarks