macro - custom filter - date less than today

ks_cr

New Member
Joined
Mar 18, 2011
Messages
2
I just need to plugin a simple logic to my macro and tired trying :( Need expert help.

I just need to filter on a column where date is less than today's date, thats it.

If I try to record this macro, it doesnt give me an option but to select today's date and the code comes like this:

ActiveSheet.Range("$A$1:$Y$1868").AutoFilter Field:=17, Criteria1:= _
"<3/18/2011", Operator:=xlAnd

Kindly guide me how to change this to achieve true today.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try

Code:
ActiveSheet.Range("$A$1:$Y$1868").AutoFilter Field:=17, Criteria1:="<" & Date, Operator:=xlAnd
 
Upvote 0
How to this formula when i am using number like (1 , 2 , 4, 5 , 12, 15) which are repetative and are of both 1 and 2 digits.

ActiveSheet.Range("$A$1:$Y$1868").AutoFilter Field:=17, Criteria1:="<" & Date, Operator:=xlAnd
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top