![]() |
Delete entire row if older then 365 days
How do I create a macro that will delete entire row if older then 365 days.
Dates are on col "A" last col of data = "U" Data is kept in sheet "details" Thank you |
Delete entire row if older then 365 days
Try;
Sub DeleteOldDates() Dim lDate As Long lDate = Date - 365 With Sheets("details") .AutoFilterMode = False .Range("A1:A2").AutoFilter Field:=1, Criteria1:="<" & lDate .AutoFilter.Range.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delet e .AutoFilterMode = False End With End Sub -- Regards Dave Hawley www.ozgrid.com "Pas" wrote in message ... How do I create a macro that will delete entire row if older then 365 days. Dates are on col "A" last col of data = "U" Data is kept in sheet "details" Thank you |
Delete entire row if older then 365 days
Sorry guys,
I'm still getting error messages with both suggestions. How do I declare the variables R, and LR as Integers . "ozgrid.com" wrote: Try; Sub DeleteOldDates() Dim lDate As Long lDate = Date - 365 With Sheets("details") .AutoFilterMode = False .Range("A1:A2").AutoFilter Field:=1, Criteria1:="<" & lDate .AutoFilter.Range.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delet e .AutoFilterMode = False End With End Sub -- Regards Dave Hawley www.ozgrid.com "Pas" wrote in message ... How do I create a macro that will delete entire row if older then 365 days. Dates are on col "A" last col of data = "U" Data is kept in sheet "details" Thank you |
All times are GMT +1. The time now is 06:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com