Macro to filter based on cell value

JV0710

Active Member
Joined
Oct 26, 2006
Messages
429
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
Good Day

Please can I have some help with VB to affect a table filter in the folowing way:

I have a table of 10 000 rows starting in row 6 and filtered on "Blanks" in column B.

I would to have a macro that will automatically change the filter based on what is typed in Cell B4 ( If B4 is Null, then keep table filtered on blanks) - If B4 is not on the list, then the filter remains on Blank

Thanks in advance for your help

JVN
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Good Day

Please can I have some help with VB to affect a table filter in the folowing way:

I have a table of 10 000 rows starting in row 6 and filtered on "Blanks" in column B.

I would to have a macro that will automatically change the filter based on what is typed in Cell B4 ( If B4 is Null, then keep table filtered on blanks) - If B4 is not on the list, then the filter remains on Blank

Thanks in advance for your help

JVN
Good Day All

I realise that I should have explained better

I have a range in Sheet named "products" The range is "A6 : P10000" - row 6 being the headers.
By default All rows with data are hidden. To do this, I am currently just filtering column B in the range on "Blanks" ---- header for column B in the range is "name"

I would like the filter in column B to automatically change based on a user entering a "name" in cell B4.
If the name entered in cell B4 is not found in column B of the range, then the range should stay filtered on blanks in column B
If the name is found then the range should automatically be filtered on column B based on the "name" entered in cell B4

The sheet will be password protected to prevent users from unhiding all the rows - only cell b4 will be unprotected to allow users to enter their "Name"

I hope this clarifies and makes my request better to understand

Thanks in Advance for your help
 
Upvote 0

Forum statistics

Threads
1,214,972
Messages
6,122,530
Members
449,088
Latest member
RandomExceller01

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