advanced filter macro not accepting date ranges

krazyderek

Board Regular
Joined
Feb 17, 2005
Messages
60
i had a macro for taking a database and applying an advanced filter to get info on an employee for each month with the following macro

Range("J14").Select
Range(Selection, Selection.End(xlToLeft)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Sheets("Database").Cells.AdvancedFilter Action:=xlFilterCopy, CriteriaRange _
:=Range("D11:F12"), CopyToRange:=Range("A13:J13"), Unique:=False

where D11:D12 is the employee name criteria, and E11:F12 is the date range, everything worked fine in excel 2003, but it doesn't work in 2010. If i back out the criteria to just be D11:D12 it works, but then i don't have a specific date range....

here's the real twist, if i do everything manually by clearing the data, going to advanced filter, it works with the date range, but the macro for the exact same steps, won't, kinda stumped...
the macro is just a module, maybe it needs to be somewhere else for 2007/2010?
 
Try this

=">"&DATE(2010,12,31)+TIME(23,59,59)

ok, i also figured i could use AND along with NOT to force the greater then to not include anything from that date, it's a little frustrating that the > is acting like >=

=AND(">"&DATE(2010,12,31),NOT("="&DATE(2010,12,31)))

any idea why this is necessary? i guess cause more precisly it's looking at the start of that date, and if i have entries with that date but a time later in the day they're probably technically after that... and vice versa for a < expression?
 
Upvote 0

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

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