Tech Support Guy banner
Status
Not open for further replies.
1 - 6 of 6 Posts

·
Registered
Joined
·
1 Posts
Discussion Starter · #1 ·
Not sure if this is just an Australias thing but I can get autofilters using dates to work using VBA. The problem is that when I trace the code it looks correct but the Custom section in excel shous me the dates in US format. Code follows:

Dim dt As Date

dt = Date - 4 ' today this is 06/03/2006 in Australian Format 10/3 - 4 = 6/3

dt = Format(dt, "dd/mm/yyyy") 'Confirm I just want the date not the time as well

Selection.AutoFilter Field:=1, Criteria1:=">=" & dt ' DT here is 06/03/2008.:D

However, when if view the data open the filter (Custom...) the data in the input box is 03/06/2008 12:00:00 am - clearly incorrect.

:(

Surely Excel is not that stupid or perhaps it is me?? :eek:
 

·
Registered
Joined
·
5,458 Posts
Yeah, dimension as String, and make only one line...

Code:
dt = Format(Date - 4, "dd/mm/yyyy")
Check your regional settings, as that is what the system will use (and Date is a system date, as well as Time), make sure they're for your specific region and the format is the way you want it (a Windows thing, not Excel).

HTH
 
1 - 6 of 6 Posts
Status
Not open for further replies.
Top