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.
[TABLE="width: 495"]
<colgroup><col><col><col span="4"></colgroup><tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD][/TD]
[TD][/TD]
[TD]Cell 1[/TD]
[TD]Cell 2[/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD]rock & lemon[/TD]
[TD][/TD]
[TD][/TD]
[TD]grape[/TD]
[TD]paper[/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD]rock & apple[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD]rock[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD]paper[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD]scissor[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]grape[/TD]
[TD]paper & lemon[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]grape[/TD]
[TD]paper & apple[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]grape[/TD]
[TD]paper[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]grape[/TD]
[TD]rock[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]grape[/TD]
[TD]scissor[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I really appreciate any help provided, and happy to clarify if it doesn't make sense!
Many thanks!
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.
[TABLE="width: 495"]
<colgroup><col><col><col span="4"></colgroup><tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD][/TD]
[TD][/TD]
[TD]Cell 1[/TD]
[TD]Cell 2[/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD]rock & lemon[/TD]
[TD][/TD]
[TD][/TD]
[TD]grape[/TD]
[TD]paper[/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD]rock & apple[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD]rock[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD]paper[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]orange[/TD]
[TD]scissor[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]grape[/TD]
[TD]paper & lemon[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]grape[/TD]
[TD]paper & apple[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]grape[/TD]
[TD]paper[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]grape[/TD]
[TD]rock[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]grape[/TD]
[TD]scissor[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I really appreciate any help provided, and happy to clarify if it doesn't make sense!
Many thanks!