VBA - is it possible to filter multiple (>2) values using wildcards(*) ?

Status
Not open for further replies.

Judge5

New Member
Joined
Apr 29, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi All!

I would like to apply a filter for multiple values (> 2), but I do not appear to be able to do that if I'm using wildcards. I'm generating a daily report with a list of addresses. Each address is in its own cell and there is not a standardized address, which is why I'm using wildcards to be able to filter by just the country name (e.g. Austria).

I am able to filter for two values using wildcards:
ActiveSheet.Range("C:C").AutoFilter Field:=1, Criteria1:=Array("*Austria*", "*Belgium*", "*Canada*"), Operator:=xlFilterValues _

And I can filter for >2 values if not using wildcards:
ActiveSheet.Range("C:C").AutoFilter Field:=1, Criteria1:=Array("Austria", "Belgium", "Canada"), Operator:=xlFilterValues _

But as soon as I add the wildcards, the filter removes all data and leaves a blank column:
ActiveSheet.Range("C:C").AutoFilter Field:=1, Criteria1:=Array("*Austria*", "*Belgium*", "*Canada*"), Operator:=xlFilterValues _

Does anyone know if this is possible to do? If this can only be achieved using advanced filters, does anyone know the coding to do that?

Would really appreciate any help you can give!!

Thank you,
Joe
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Status
Not open for further replies.

Forum statistics

Threads
1,214,989
Messages
6,122,622
Members
449,093
Latest member
catterz66

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