VBA - Excel - Using an Array for AutoFilter criteria on a table RRS feed

  • Question

  • matches_present returns a Boolean value. match_n is an integer. When matches are present, I want to be able to apply an autofilter for field 5 where the criteria is inclusive of each member from 0 to match_n of MatchArray(match_n).

            If Not matches_present Then
                sht.ListObjects("Table").Range.AutoFilter field:=5, Criteria1:=acctNum
                sht.ListObjects("Table").Range.AutoFilter field:=5, Criteria1:=MatchArray(match_n)
            End If

    What I have will only autofilter for the last member of the array. How do I do this?

    Tuesday, June 6, 2017 5:27 PM


  • sht.ListObjects("Table").Range.AutoFilter field:=5, _ Criteria1:=Array(MatchArray()), Operator:=xlFilterValues

    • Marked as answer by Alex_Intern Tuesday, June 6, 2017 7:26 PM
    • Edited by Alex_Intern Tuesday, June 6, 2017 7:27 PM
    Tuesday, June 6, 2017 7:26 PM