Advanced Filter doesnt work in VB2007

K

Kev

So I create a macro which performs an advanced filter on a range of data,
during the recording (or any time I perform the advanced filter manually) it
works perfectly.

However when I run the Macro it doesn't work. No errors, it just doesnt
copy any data over to the new location, or even if I set the macro to filter
in place, it just removes all data.

Its basically giving a result that suggests that there were no records that
matched the criteria, despite it working fine when done manually.

This is only in Excel 2007 as the exact same work book worked fine in Excel
2003.

I have done some testing and eventually discovered that it is being affected
by Date criteria. If I am filtering with just a text or number criteria then
its all fine. It also doesnt matter whether its an actual date or a date
formula (e.g. >=01/01/08).

Below is my macro

Columns("A:F").Select
Columns("A:F").AdvancedFilter Action:=xlFilterCopy,
CriteriaRange:=Sheets( _
"sht_filters").Range("C3:G4"), CopyToRange:=Range("G1:L1"),
Unique:=False


So does anyone know why the dates would be affecting it (they are in UK
format if that matters?), and why it would only be an issue when run in VB
rather than a manual filter in XL?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top