有没有办法使用高级过滤器在 VBA 中搜索多个文本字符串

Is there a way to use the advanced filter to search for multiple textstrings in VBA

我正在尝试使用高级过滤器过滤同一数据集中的多个项目。为此,我尝试使用通配符 * 以便它找到所有包含 Sheet 输入文本字符串的项目,但是我无法让它工作。

我尝试使用的代码如下:

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 ` 

我试过将通配符 * 直接添加到单元格中,但这也没有用。

此外,我已经尝试创建一个数组,但是我无法让它工作。

希望大家能帮我搞定代码。

你可以做到这一点。

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