Okay, thanks Steve. This now runs but when it runs its quirky. Just to
see exactly what it was deleting I had it put an X in the far right
column instead of delete. Then I colored and sorted. It seems like
this does ignore anything with a blank or a 0000 in column K but it
deletes everything else, no matter what the value of column M is. The
values in column M were set up as general so I changed them to date to
see if that would make a difference but it didn't. They are in this
format, mm/dd/yy in every cell and I can't figure out why it deletes
all of them, even if they are greater than the specified date. I even
had it put the Now- 9 in the cell instead of the X and the dates are
coming out okay. It doesn't make sense to me. Help?
STEVE BELL Wrote:
i does not increment unless the if statement runs,
so it will stay = 2 forever
put i = i + 1
after the End If
and remove the quotes from i = "2"
Public Sub conditional()
Dim i as long
i = 2
Do While Range("A" & i).Value < ""
If Range("K" & i).Value < "" And Range("K" & i).Value < "0000" And
Range("M" & i).Value Now - 9 Then
Range("K" & i).EntireRow.Delete
End If
i = i + 1
Loop
End Sub
--
steveB
--
DKY
------------------------------------------------------------------------
DKY's Profile:
http://www.excelforum.com/member.php...o&userid=14515
View this thread:
http://www.excelforum.com/showthread...hreadid=387731