0

I want to use filter by multiple data in Excel VBA. at first time, I used 'for' and 'find' method, but it's too slow for processing.

In case of Python, Use the 'Pandas modules'and dataframe, Like below sample filter = dataframe['headername"].isin([Listdata1, Listdata2, Listdata3..])

but I couldn't find similar method in VBA.

Here is My background data1:

excel capture

4
  • I've removed the excel-vba tag. The description fo that tag clearly says (in ALL CAPS) that the tag is pending removal and should not be used, and explains what should be used instead. Please read the description of tags before using them to make sure they're appropriate for your question. Thanks. Commented Jan 2, 2019 at 2:35
  • @KenWhite - I've have been wondering why the access-vba, word-vba, powerpoint-vba tag descriptions never received that 'disclaimer'? Commented Jan 2, 2019 at 3:11
  • @user10852207: Don't know. You might ask at Meta Stack Overflow to see if anyone does, though. There's also a link to Meta Stack Overflow in the description of the excel-vba tag after the notice that it shouldn't be used. Commented Jan 2, 2019 at 3:18
  • Nice dodge @kenwhite Commented Jan 2, 2019 at 7:04

1 Answer 1

1
Sub MultiSelectFilter()

    Dim arr As Variant

    ' Range containing values to be shown
    arr = Range("C1:C3")

    ' Range to be filtered
    Range("A1").AutoFilter
    Range("A1").AutoFilter Field:=1, Criteria1:=Application.Transpose(arr), Operator:=xlFilterValues
End Sub
Sign up to request clarification or add additional context in comments.

3 Comments

Thank you very much! this is that i wanted, i have a one more question, Can i filter reversed selection(invert) by modifying operator?
@HeartAimDJ - nope. Excluding multiple criteria is much more complex - stackoverflow.com/questions/28504517/…
That's too bad, Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.