none
VBA - Auto Filter on 2 Columns - with a Type As You Search Box RRS feed

  • Question

  • Hi Friends,

     

    Hope all are doing great!

     

    I have a basic spreadsheet and am trying to autofilter type as you search

     

    On 2 Criteria in 2 columns.

     

    I would like only Car honda not Boat honda to appear as well.

     

    I set up a basic text box  and have spent the day unable to create a AND filter to make this happen.

     

    Below is my search box

     

       Private Sub TextBox1_Change()

     

        ActiveSheet.ListObjects("Cars").Range.AutoFilter Field:=2, _

            Criteria1:="*" & [C3] & "*", Operator:=xlFilterValues

    End Sub

     

     

    In which way can I add my second filter, so I can search  on 2 columns to get only

     

    Cars --- > honda

    I am trying to emulate a real time search - as i will later search for other cars - so I know you can use an array , or do individual macros , but then i will have to make a macro for each search criteria and that will be alot of macros

    thank you for your time


    Cheers Dan :)



    • Edited by Dan_CS Friday, November 4, 2016 1:21 AM clarification and something happened to the font
    Friday, November 4, 2016 1:14 AM

Answers

All replies

    • Marked as answer by Dan_CS Friday, November 4, 2016 12:10 PM
    Friday, November 4, 2016 8:11 AM
  • Hello Andreas,

     

    Thank you for this spreadsheet idea.

     

    This is exactly what I was trying to do but I couldn't explain it to google, and found so much more complex stuff on filtering that I couldn’t adapt to my spreadsheet.

     

    I can adapt this to make my search boxes now yay :)

     

    Thank you very much for the point in the right direction.

     

    Without it I would be spending another day in stress :(

     

    Have a good weekend my friends



    Cheers Dan :)

    Friday, November 4, 2016 12:10 PM