Link to home
Start Free TrialLog in
Avatar of Seamus2626
Seamus2626Flag for Ireland

asked on

Clear filters from slicers

I have a slicer named Sales Team in my worksheet, can i have a line of code that just clears that slicer?

Thanks
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Do you really need code?

There should be a Filter symbol at the top of the slicer selection list which clears the selection.

Thanks
Rob H
The code below should clear a specific slicer.  You will need to go into Slicer Settings for your Sales Team slicer to get the name to use in formulas.  In the code below and the picture it is "Slicer_Sales_Type41".

Sub Clear_Slicer()

    Dim scLong As SlicerCache
    Dim wb As Workbook
    
    Set wb = ThisWorkbook
    Set scLong = wb.SlicerCaches("Slicer_Sales_Type41")
    
    scLong.ClearManualFilter

End Sub

Open in new window

User generated image
ASKER CERTIFIED SOLUTION
Avatar of Jerry Paladino
Jerry Paladino
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial