Inputbox macro filter using "Contains"

T

Tony S.

I'm trying to use a macro to filter partial info in the cell. I can't figure
out what to replace the "=" with to allow "Contains" to be searched for.

Sub filter3()
c1 = InputBox("Enter Partial #")
Range("A2:A9912").AutoFilter Field:=1, _
Criteria1:="=" & c1, Operator:=xlAnd '--------Problem ------
End Sub

Any help would be appreciated.
Tony
 
T

Tony S.

Holly cow! So fast and so accurate. That did exactly what I needed. Thanks
you very much Ron!
 
D

Dave Peterson

Record a macro when you filter using contains and you'll see that excel
surrounds your text with asterisks:

Criteria1:="=*" & c1 & "*"
 
T

Tony S.

Excellent idea Dave. Thanks for the advice.

Dave Peterson said:
Record a macro when you filter using contains and you'll see that excel
surrounds your text with asterisks:

Criteria1:="=*" & c1 & "*"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top