Reset all Slicers – Excel VBA

I have started to regularly use slicers in pivot tables so that users can filter by category etc, however I found that often users would resave the document but not reset all the slicers.  So the following Macro code is a quick way to clear all the slicers in a workbook.

I have this run at the end of my macro to put everything back the way it should be, but you could also attach this to a button “reset filters” or similar.

 

Dim slcr As SlicerCache

    For Each slcr In ActiveWorkbook.SlicerCaches
    
        slcr.ClearManualFilter
    Next slcr

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.