Thread: delete if
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
flow23
 
Posts: n/a
Default delete if

I need help with this macro

IF rows are hidden it work fine, but if its rows delete then it skips some
records.

what i want is the loop to delete from bottom up , which should resolve the
issue or any suggestions.

Many thanks


Sub deleterecd() ' delete records that are more than 12 months old.
coldep = 23
For i = 2 To Cells(65000, coldep).End(xlUp).Row
If Cells(i, coldep) < DateSerial(Year(Date), Month(Date) - 12, Day(Date)) Then
Rows(i).Delete
End If
Next i
End Sub