Multiple Filtering in Excel VBA?

后端 未结 2 519
生来不讨喜
生来不讨喜 2021-01-13 00:20

I\'m trying to filter my data using 2 columns and 2 different filter requirements.

    ActiveSheet.AutoFilterMode = False
    ActiveSheet.Range(\"$K$2:$ZZ$20         


        
2条回答
  •  孤城傲影
    2021-01-13 01:10

    You have to use the same Range("$K$2:$ZZ$200") for both AutoFilter statements:

    ' Column A = Field 1
    ActiveSheet.Range("$K$2:$ZZ$200").AutoFilter Field:=1, Criteria1:="yes"
    ' Column E = Field 5
    ActiveSheet.Range("$K$2:$ZZ$200").AutoFilter Field:=5, Criteria1:="Low"
    

    Also, you may need to set ActiveSheet.AutoFilterMode = True, but I'm not entirely sure.

提交回复
热议问题