Autofilter

millhouse123

Active Member
Joined
Aug 22, 2006
Messages
335
I have this line of code that filter on 2 criteria. I currently have one of the criteria set as the date and it is hard coded as 8/22/2006. This date changes daily.

What I want todo is replace the date with a variable but when I do it gives me an error.

Basically I have Date = 9/19/2006 or whatever date it might be. What I want to do is put the variable in below instead of the hard coded date. How can I do this.

Thanks

Selection.AutoFilter Field:=8, Criteria1:="DONE"
Range("W5").Select
Selection.AutoFilter Field:=23, Criteria1:="> 8/22/2006", Operator:=xlAnd
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Try this, which should use the current date:

Code:
Selection.AutoFilter Field:=8, Criteria1:="DONE" 
Range("W5")..AutoFilter Field:=23, Criteria1:=">" & Date, Operator:=xlAnd

I'll check back to see if this works or not. This PC (not mine) has a trial version of Office :x

HTH

Hi to all from Rocky Mountain country! Good to be back!
 
Upvote 0

Forum statistics

Threads
1,219,162
Messages
6,146,661
Members
450,706
Latest member
LGVBPP

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