基于多个条件集创建自动过滤器

问题描述 投票:0回答:0

我正在根据另一个“过滤表”中预先创建的可定制标准集创建过滤器。但是,我想根据条件集在另一个显示表中对这些过滤器进行排序。

示例:在过滤表中,我有集合 A、B 和 C。A 包含公司 X、Y、Z; B 包含公司 Q、Y、Z 和 C 仅包含公司 X.

现在,在显示表中,我有一个集合 A、B、C 的下拉列表。我想根据集合中的标准显示在这张表中(如果我选择集合 A,则只显示公司 X、Y、Z)。

这是我当前的代码:

 With Worksheets("Data Sheet")
        With .Range("A2:R" & .Cells(.Rows.Count, "A").End(xlUp).Row)
        
            .AutoFilter Field:=5, criteria1:= Sheet1.Range("C6") 

'Filter Field 5 (Column E) displays all companies and I want the criteria to be set based on the previously mentioned criteria sets (A,B,C). "Sheet1.Range("C6")" is the cell with the dropdown list

提前致谢!

excel vba filter set criteria
© www.soinside.com 2019 - 2024. All rights reserved.