delete entirerow if date more than 12months old
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? |
delete entirerow if date more than 12months old
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 |
All times are GMT +1. The time now is 02:26 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com