Macro for auto filtering based on cell value

likun6

New Member
Joined
Sep 27, 2017
Messages
2
Hi All,

Could someone please help me to write a macro that filters the selection of data based on a cell value?

The situation is:

Let's say I have 2 columns A & B, and I have 2 other cells that I can enter value in them.

I need the macro to auto filter column B by searching the content of cell 1, and then also auto filter column C by searching the content of cell 2.

Using the example below, if I enter grape and paper into Cell 1 and 2 respectively, then it should automatically filter for rows 6-8.


ABCell 1Cell 2
orangerock & lemongrapepaper
orangerock & apple
orangerock
orangepaper
orangescissor
grapepaper & lemon
grapepaper & apple
grapepaper
graperock
grapescissor

<colgroup><col><col><col span="4"></colgroup><tbody>
</tbody>


I really appreciate any help provided, and happy to clarify if it doesn't make sense!

Many thanks!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Sorry it's supposed to say:

I need the macro to auto filter column A by searching the content of cell 1, and then also auto filter column B by searching the content of cell 2.


Apologies for the confusion!
 
Upvote 0

Forum statistics

Threads
1,215,457
Messages
6,124,941
Members
449,198
Latest member
MhammadishaqKhan

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