Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 60
Default Inputbox macro filter using "Contains"

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Inputbox macro filter using "Contains"

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 60
Default Inputbox macro filter using "Contains"

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Inputbox macro filter using "Contains"

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 60
Default Inputbox macro filter using "Contains"

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing" ldiaz Excel Discussion (Misc queries) 2 March 16th 08 09:23 PM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM
Inputbox calculations and "outputbox" CC Excel Discussion (Misc queries) 0 July 14th 06 09:15 AM
inputBox calculations and msgbox or "outputBox" CC Excel Worksheet Functions 0 July 14th 06 09:11 AM
Compile Error in Excel 2004 when Inputbox contains "VBCRLF" QTP Professional Excel Discussion (Misc queries) 1 November 18th 05 11:47 PM


All times are GMT +1. The time now is 10:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"