clear active filter from all columns except for active column

nabeelzz

Board Regular
Joined
Sep 23, 2014
Messages
69
Good day all,

i have a question. I use excel filters all day long.
I usually apply it to huge data tables on many columns simultaneously.

It would help if i have a method or Macro which will remove all active filters except from the columns of active cell.

Let me explain !!!
Say i have applied filters in 6 columns
now i need to change the filter settings in 4 columns
Currently I use ALT+D+F+S to clear all the active filters and then start filtering again from beginning.

what i would prefer to do is.
Say i have filters applied in 6 columns. But i want the filters to be applied in 2 columns only and remove from other 4 columns,
then i would select cells in the 2 columns where i want the filters to stay.
then run the macro which will remove the applied filters on other 4 columns

if someone can help, it will be great
let me know if you need further clarification
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Assuming you're using Autofilter...

Code:
[color=darkblue]Sub[/color] Clear_Filters_Unselected_Columns()
    [color=darkblue]Dim[/color] col [color=darkblue]As[/color] Range
    Application.ScreenUpdating = [color=darkblue]False[/color]
    [color=darkblue]With[/color] ActiveSheet.AutoFilter.Range
        [color=darkblue]For[/color] [color=darkblue]Each[/color] col [color=darkblue]In[/color] .Columns
            [color=darkblue]If[/color] Intersect(col, Selection) [color=darkblue]Is[/color] [color=darkblue]Nothing[/color] [color=darkblue]Then[/color]
                .AutoFilter col.Column
            [color=darkblue]End[/color] [color=darkblue]If[/color]
        [color=darkblue]Next[/color]
    [color=darkblue]End[/color] [color=darkblue]With[/color]
    Application.ScreenUpdating = [color=darkblue]True[/color]
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,260
Members
452,627
Latest member
KitkatToby

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