Macro to clear data filters and pivot table filters on all worksheets in workbook

jeff_cp

Board Regular
Joined
May 21, 2015
Messages
71
I've got a spreadsheet that consists of dozens of worksheets that compiles data for a summary worksheet. When a user filters one of the data tables or pivot tables, it changes the totals on the summary worksheet. I'd like to put a Clear All Filters button on the summary worksheet that will remove all filters on all worksheets. Is this possible without clearing them individually?
 

Some videos you may like

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

CeceR

New Member
Joined
Mar 30, 2011
Messages
10
Try looping through the sheets with something like this. This should clear any filters on all sheets. I've not tested it, but I can mock something up if you run into problems.

VBA Code:
Sub ClearFilters*(
For j = 1 To Sheets.Count
    
    Sheets(j).Activate
    Sheets(j).AutoFilter.ShowAllData

Next j
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,126,897
Messages
5,621,499
Members
415,845
Latest member
marej123

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
Top