FOR Statement Issue
I'm having a problem when DELETING a row that I don't want ... it skips the
next row.
Here's the code:
Dim cell As Range
For Each cell In Worksheets("sheet1").Range("A1:A5")
If Not (cell.Text Like "Y") Then
cell.EntireRow.Delete
End If
Next
Here's the data set:
A
1 Y
2 N
3 N
4 Y
Cell A2 is deleted, but A3 is not deleted. Apparently, after deleting Cell
A2, Cell A3 assumes that position and it moves to Cell A4.
Any ideas how to resolve this?
Thanks.
Gary
|