Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
COUNTIF for numbers of dates in column which are 30 days older than today | Excel Worksheet Functions | |||
Computing days between TODAY() and older date in a cell | Excel Discussion (Misc queries) | |||
How do I add a range by date over 90 days older than today | Excel Discussion (Misc queries) | |||
formula to find and flag dates older than 30 days | Excel Worksheet Functions | |||
Dates older than 29 days | Excel Discussion (Misc queries) |