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

jeff_cp

Board Regular
Joined
May 21, 2015
Messages
84
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?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
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
 
Upvote 0

Forum statistics

Threads
1,214,782
Messages
6,121,532
Members
449,037
Latest member
tmmotairi

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