Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Tony
Try this Criteria1:="=*" & C1 & "*" -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Tony S." wrote in message ... 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 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Holly cow! So fast and so accurate. That did exactly what I needed. Thanks
you very much Ron! "Ron de Bruin" wrote: Hi Tony Try this Criteria1:="=*" & C1 & "*" -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Tony S." wrote in message ... 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 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Record a macro when you filter using contains and you'll see that excel
surrounds your text with asterisks: Criteria1:="=*" & c1 & "*" Tony S. wrote: 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 -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Excellent idea Dave. Thanks for the advice.
"Dave Peterson" wrote: Record a macro when you filter using contains and you'll see that excel surrounds your text with asterisks: Criteria1:="=*" & c1 & "*" Tony S. wrote: 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 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing" | Excel Discussion (Misc queries) | |||
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" | Excel Discussion (Misc queries) | |||
Inputbox calculations and "outputbox" | Excel Discussion (Misc queries) | |||
inputBox calculations and msgbox or "outputBox" | Excel Worksheet Functions | |||
Compile Error in Excel 2004 when Inputbox contains "VBCRLF" | Excel Discussion (Misc queries) |