is there a more efficient way to clear (not remove) all filters (autofilter, pivot table filters, slicers, tables) within the activeworkbook than this code that i have pieced together this morning?
Code:
Sub unFilters2()
Dim ws As Worksheet
Dim tObj As ListObject
Dim objSlicer As SlicerCache
Dim pt As PivotTable
For Each ws In ActiveWorkbook.Worksheets
If ws.AutoFilterMode Then
'clear all filters on worksheets
If ws.AutoFilter.FilterMode Then
ws.AutoFilter.ShowAllData
End If
End If
For Each tObj In ws.ListObjects
' clear all filters in tables
tObj.AutoFilter.ShowAllData
Next
For Each pt In ws.PivotTables
'clear all pivot table filters
pt.ClearAllFilters
Next
Next ws
For Each objSlicer In ActiveWorkbook.SlicerCaches
'clear all slicer caches
objSlicer.ClearManualFilter
Next objSlicer
End Sub