ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filter and Delete all rows with a date greater than or = today (https://www.excelbanter.com/excel-programming/405640-filter-delete-all-rows-date-greater-than-%3D-today.html)

Tasha

Filter and Delete all rows with a date greater than or = today
 
I am trying to create a macro that will delete all rows with a date greater
than or equal to today. The date is from the prior year, in column B. I
can't use criteria greater than or = to today because the date is from last
year. For instance I need to delete any rows with data equal to or greater
than the 5th deleted. The date will change as the days change. So, tomorrow
I would need filtered and deleted for the 6th and above. Row B is formatted
as D, so only the number of the day is showing. Can someone help me with
this please? This is what I have, but know why it isn't working....because
it's trying to filter for today's date(this year).

Columns("B:B").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=today()", Operator:=xlAnd


All times are GMT +1. The time now is 10:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com