For/Next Is Not Looping - Only Deletes First Instance
This code compares dates in range A5:A500 if any of them are greater
than the value in A1 it deletes that row.
It only deletes the first row that meets this criteria, then it
stops. If I copy the block of code twice, it works on the first two
rows. How can I make this loop?
Dim c As Range, compdate As Date
compdate = Range("A1").Value
If IsDate(compdate) Then
For Each c In Range("A5:A500", Range("K65536").End(xlUp))
If IsDate(c.Value) And c.Value compdate Then
c.EntireRow.Delete
End If
Next
End If
|