chungtinhlak
01-14-2009, 05:55 PM
Column O contains 19 rows with 1 on it, there for, it should delete 19, but it always delete 18, i have to run the code the second time for it to delete that last one. why? the last one is located at row 519.
Dim usedcell as long
'usedcell is over 4000.
Range("O1").Select
For i = 2 To usedcell
If Range("O" & i).Value = "1" Then
Range(i & ":" & i).Delete Shift:=xlUp
x = x + 1
End If
Next i
Dim usedcell as long
'usedcell is over 4000.
Range("O1").Select
For i = 2 To usedcell
If Range("O" & i).Value = "1" Then
Range(i & ":" & i).Delete Shift:=xlUp
x = x + 1
End If
Next i