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?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Change E12 to

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

And F12 to

="<" &DATE(2011,2,1)

another problem popped up, where in the example above, it will include items from 2010,12,31 and great in the data range instead of only items greater then 2010,12,31

is it possible to add time after the date and set it to > 2010,12,31 11:59:59pm ??
 
Upvote 0
another problem popped up, where in the example above, it will include items from 2010,12,31 and great in the data range instead of only items greater then 2010,12,31

is it possible to add time after the date and set it to > 2010,12,31 11:59:59pm ??
Try this

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

Forum statistics

Threads
1,224,521
Messages
6,179,287
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