Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

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
0
Seamus2626
Asked:
Seamus2626
  • 2
1 Solution
 
Rob HensonIT & Database AssistantCommented:
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
0
 
Jerry PaladinoCommented:
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

Slicer Settings to find Formula Name
0
 
Jerry PaladinoCommented:
If you want the above in a single statement...
ThisWorkbook.SlicerCaches("Slicer_Sales_Type41").ClearManualFilter

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now