Adding dynamic excel filter search box to existing exel tables?

louai

New Member
Joined
Nov 4, 2018
Messages
8
Hello all,

Please help me with this. I have tried many vba and tutorials on youtube but with no any luck. I wanna add dynamic excel filter search box to existing exel tables.

Can you please help with any tips?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Can you put a simple example of what you want to reach?

For example, let's say you have a table with titles in Line 2
A Car Brand
B Car model
C Car price

You want a list in A1 combining cars and model that would filter the table on selected model?
 
Upvote 0
Pretty easy. Make a Table (insert tab, table) and Name it (design tab, Table Name). I name mine TblSales.

Then yo got to devloper tab (you can make it appear from File/options/custom ribbon if yo don't have it already).

Go to insert and chose the ActiveX Textbox (the one with ab| ).

Draw one on yor table sheet. Right click and go to properties. In linked cell, chose an empty cell and typed its reference. I chose a1.

Right click yor textbox again and click view code

Code:
Private Sub TextBox1_Change()
[COLOR=#008000]'Replace the words TblSales and a1 with your own table name & linked cell address. You can also change the field number (2) to the column to filter[/COLOR]
ActiveSheet.ListObjects("TblSales").Range.AutoFilter Field:=2, Criteria1:="*" & [a1] & "*", Operator:=xlFilterValues
End Sub
.

You can click the little play in VBA after you click between private sub & end sub you jst pasted or get out of design mode in devloper tab. It works already.
 
Last edited:
Upvote 0
Wow that worked for me! amazin.

Please can you to this: how to apply this code to the whole sheet? so not only for 1 table but for all text on the whole sheet?
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top