Facing problem in finding Syntax for Advanced auto filter with wildcards using Macros

girishankar09

New Member
Joined
Mar 16, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
I have created an event like when something changes in a cell, then an advanced filter should happen.

The values to be filtered will be in C2:E3 with C2,D2,E2 as headers. the values will be filtered in B6:D67 with B6,C6,D6 as headers.

Now the issue is:

the values which I filter with CriteriaRange are dynamic with values like "BF Delete", "Ship Easy" "English/French", UK,IN which might contain spaces, / etc

The values in the ranger where I apply filter are even more complex and the example are like "BFA BF Delete", DIIP Ship Easy (US & IN).

I code which I wrote are taking exact match and does not work when they have space, commas, forward slash or brackets.

I want it to work it this way and I am unable to find the correct syntax or format I can write the macros for my use case for it to work even when partial words match. My code is mentioned below.


Sub FilterData()
Range("B6:D67").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("C2:E3"), Unique:=False

End Sub


I tried the link below and edited the code to below however but it states .Address is invalid.

Sub FilterData()
Range("B6:D67").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("C2:E3"), Unique:=False
With Range("C2:E3").Value = Evaluate("""*""&" & .Address & "&""*""")
End With
End Sub

I want the search to be flexible since the search term might be anywhere from between to starting
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,214,621
Messages
6,120,563
Members
448,972
Latest member
Shantanu2024

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