0

I'm trying to filter for several items in the same data set with the advanced filter. For this I'm trying to use the wildcard * so it finds all items that include the textstring on Sheet Input, however I have not been able to get this to work.

The code I am trying to use is as follows:

Range("B6").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.AdvancedFilter Action:=xlFilterInPlace,CriteriaRange:=Sheets("Input").Range("A6:A8"), Unique:=False ` 

I have tried adding the wildcard * to the cells directly but this also did not work.

In addition I have tried creating an array, however I have not been able to get this to work.

Hope you guys can help me out with the code.

SJR
  • 22,986
  • 6
  • 18
  • 26
Ted0710
  • 5
  • 1
  • Read this https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba – SJR Mar 19 '21 at 16:40
  • 2
    Hard to say without seeing any data - perhaps post a screenshot? – SJR Mar 19 '21 at 16:41
  • As the data is confidential I sadly cannot post a screenshot of the data. However I have included the formula I am currently using to sort for 2 items. – Ted0710 Mar 19 '21 at 17:35

1 Answers1

0

You can do this.

Sheet1.Range("A1:E1").AutoFilter Field:=3, _
                                 Criteria1:=Array("Product A", "Product B"), _
                                 Operator:=xlFilterValues

enter image description here

ASH
  • 20,759
  • 19
  • 87
  • 200