VB to filter table using text added to a cell

scotthannaford1973

Board Regular
Joined
Sep 27, 2017
Messages
112
Office Version
  1. 2010
Platform
  1. Windows
Hi

I have a sheet "Folders" which has a huge table of data; I then have another sheet "Search" with a cell K11 into which I'd like colleagues to type a search term and for that to effectively be copied and pasted into a filter for "Folders" column C, so that whatever they type in Search!K11 and click onto a button, automatically takes them to "Folders" and shows the filtered results.

Hope that makes sense!

TIA
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi @scotthannaford1973, thanks for posting on the forum.

whatever they type in Search!K11 and click onto a button, automatically takes them to "Folders" and shows the filtered results.

Put the following code in a button on your "Search" sheet.
Type something in cell K11 of the "Search" sheet and press the button.

VBA Code:
Sub searching()
  Sheets("Folders").Select
  If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilterMode = False
  Range("C:C").AutoFilter 1, "*" & Sheets("Search").Range("K11").Value & "*"
End Sub


--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------
 
Upvote 1
Solution
Hi @scotthannaford1973, thanks for posting on the forum.



Put the following code in a button on your "Search" sheet.
Type something in cell K11 of the "Search" sheet and press the button.

VBA Code:
Sub searching()
  Sheets("Folders").Select
  If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilterMode = False
  Range("C:C").AutoFilter 1, "*" & Sheets("Search").Range("K11").Value & "*"
End Sub


--------------
Let me know the result and I'll get back to you as soon as I can.
Cordially
Dante Amor
--------------
That works beautifully - many thanks!
 
Upvote 1

Forum statistics

Threads
1,215,361
Messages
6,124,497
Members
449,166
Latest member
hokjock

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