none
Macro - Custom Filter RRS feed

  • Question

  • Sub Macro1()
    ' Macro1 Macro
        ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, Criteria1:= _
            "=?", Operator:=xlAnd
    End Sub

    I would like the user to input a value at ? and then have them complete the filter on enter.  Is this possible?

    Thanks,

    Saturday, August 4, 2012 7:05 AM

All replies

  • Like Paramater Query right!!!!

    But I think in excel autofilter context it is not doable.You can get the input by Application.InputBox,set to a variable and filter.

    Dim sInput as String

    'Change the string to appropriate datatype

    sInput=application.InputBox prompt:="Pls put a" string..",type:=xltextvalues,default:="Hands7"

    ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=1, Criteria1:= _
            sInput, Operator:=xlAnd


    Asadulla Javed

    Saturday, August 4, 2012 7:21 AM
    Answerer