![]() |
Using Autofilter with User Input
I have a 10,000 row parts catalog worksheet, with columns for parts #, part location, and description. I want to filter the description column based on the what the user enters in a user form. I am having some trouble doing this though. Here is some code I tried (from recording a macro), where "input1" and "input2" are what I have named the text box values in the user form that the user enters the search criteria. Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=*input1*", Operator:=xlAnd, _ Criteria2:="=*input2*" What is actually happening when I use this code is that the column is being filtered by the actual words input1 and input2, as opposed to being filtered by the userform textbox values that I assigned to the names input1 and input2. Any help on how to fix this would be greatly appreciated. Also, if anyone has suggestions on maybe a better method to search or filter a catalog, using a very easy and simply user interface, it would be awesome. Thanks, Kyle -- kylec ------------------------------------------------------------------------ kylec's Profile: http://www.excelforum.com/member.php...o&userid=35541 View this thread: http://www.excelforum.com/showthread...hreadid=553041 |
Using Autofilter with User Input
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=*" & input1 & "*", Operator:=xlAnd, _ Criteria2:="=*" & input2 & "*" -- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "kylec" wrote in message ... I have a 10,000 row parts catalog worksheet, with columns for parts #, part location, and description. I want to filter the description column based on the what the user enters in a user form. I am having some trouble doing this though. Here is some code I tried (from recording a macro), where "input1" and "input2" are what I have named the text box values in the user form that the user enters the search criteria. Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=*input1*", Operator:=xlAnd, _ Criteria2:="=*input2*" What is actually happening when I use this code is that the column is being filtered by the actual words input1 and input2, as opposed to being filtered by the userform textbox values that I assigned to the names input1 and input2. Any help on how to fix this would be greatly appreciated. Also, if anyone has suggestions on maybe a better method to search or filter a catalog, using a very easy and simply user interface, it would be awesome. Thanks, Kyle -- kylec ------------------------------------------------------------------------ kylec's Profile: http://www.excelforum.com/member.php...o&userid=35541 View this thread: http://www.excelforum.com/showthread...hreadid=553041 |
All times are GMT +1. The time now is 12:19 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com