Advanced filter macro failing

HANSEMINATOR

New Member
Joined
Nov 10, 2013
Messages
6
Hi!

After having solved countless Excel related tasks using this forum, I thought I'd better register and say hi and thanks.

I am however also at the moment seriously stuck and could use help.

Problem is that I want to filter data finding all relevant people based on:

  • Location
  • Activity Dates (only people active between two dates)
  • Group

I was inspired by this approach Advanced custom date filter in Excel 2007 | Get Digital Help - Microsoft Excel resource

only thinking that I could take my form data and make a hidden version of what has been done in the example above.

My vba code does however fail, which is very weird, because the code has been generated by a recording a macro, which succeeds when i record it! :(

Have anybody ever experienced this? Or do you perhaps have a other suggestion how to filter the data?

The filter code which is generated by the macro looks as follows:

Code:
    ThisWorkbook.Sheets("Data").Range("A1:O788").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
    Sheets("Hiddensheet").Range("A1:O2"), Unique:=False

Really appreciate the help
Regards
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
How does it fail?

What's your criteria and what's in the criteria range?
 
Upvote 0
It fails by not finding the same entries as are found when I use the exact same data and criteria range and run the advanced filtering tool "inside" excel.

It never finds any entries actually.

My criteria range is the first two rows Range A1:Y2 and looks like this:

I want to be able to find all entries with a specific location, group that has an end date within a specific interval. So I am giving the filter 4 criteria.
ABCDEFGHIJKLMNOPQRSTUVXY
1LocationEnd DateEnd DateGroup
2xx>=dd/mm/yyyy<=dd/mm/yyyyxxx
3

<tbody>
</tbody>

The data sheet which it is filtering looks as follows:

Has a lot of headings and only real difference is that there is only one End Date column

ABCDEFGHIJKLMNOPQRSTUVXY
1First NameLast nameLocationEnd DateGroup
2xxxxx
3

<tbody>
</tbody>
 
Upvote 0
FIXED the date problem!

Seems that Excel uses my EU dd/mm/yyyy settings when running the advanced filter from GUI, but when applying the filter in VBA it will use the US format...
 
Upvote 0
Glad you got it sorted.:)

By the way, you don't need to have the criteria in the same columns as the data.

So you could put the criteria in A1:D2.
 
Upvote 0

Forum statistics

Threads
1,213,484
Messages
6,113,923
Members
448,533
Latest member
thietbibeboiwasaco

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