Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
PAS PAS is offline
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 464
Default 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   Report Post  
Posted to microsoft.public.excel.misc
PAS PAS is offline
external usenet poster
 
Posts: 26
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
COUNTIF for numbers of dates in column which are 30 days older than today [email protected] Excel Worksheet Functions 4 April 3rd 23 02:39 PM
Computing days between TODAY() and older date in a cell Big UT Fan Excel Discussion (Misc queries) 3 November 14th 06 08:14 PM
How do I add a range by date over 90 days older than today John DeLosa Excel Discussion (Misc queries) 4 February 16th 06 09:30 PM
formula to find and flag dates older than 30 days Will G. Excel Worksheet Functions 1 June 18th 05 12:13 AM
Dates older than 29 days ab Excel Discussion (Misc queries) 2 June 16th 05 09:52 PM


All times are GMT +1. The time now is 04:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"