delete entirerow if date more than 12months old

F

flow23

I want to delete the entire row if the date in column B (yyyymm format e.g.
200605 for may 2006) is more than 12 months old.

how do I write the if statement in the macro?
 
J

JB

http://cjoint.com/?fzqFMePa5S

Sub test()
coldep = 2
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).Hidden = True ' replace Hidden by delete
End If
Next i
End Sub


Cordialy JB
 
Top