Combine multiple exclusion (<>) criteria in AutoFilter

后端 未结 1 1903
挽巷
挽巷 2021-01-18 20:57

I have worked around my issue by using this dirty hack:

    \' Filter managerial functions
    ActiveSheet.Range(\"$A$1:$BW$2211\").AutoFilter Field:=36, Cri         


        
相关标签:
1条回答
  • 2021-01-18 21:01

    An advanced filter might be more suitable for this purpose.

    You could also do something like this:

    Dim bUnion As Boolean
    Dim i As Long
    Dim vData As Variant
    Dim rDataHide As Range
    
    vData = Application.Transpose(ActiveSheet.Range("$AJ$1:$AJ$2211"))
    bUnion = False
    
    For i = 1 To 2211
      If LenB(vData(i)) Then
        If vData(i) Like Whatever Or vData(i) Like Whatever2 Then
          If bUnion Then
            Set rDataHide = Union(rDataHide, ActiveSheet.Range("$AJ$" & i))
          Else
            Set rDataHide = ActiveSheet.Range("$AJ$" & i)
            bUnion = True
          End If
        End If
      End If
    Next i
    rDataHide.Rows.Hidden = True
    

    You could even use RegEx, I haven't really used RegEx much before though so you would have to google it.

    0 讨论(0)
提交回复
热议问题