Solved

Clear filters from slicers

Posted on 2014-07-31
3
189 Views
Last Modified: 2014-08-05
I have a slicer named Sales Team in my worksheet, can i have a line of code that just clears that slicer?

Thanks
0
Comment
Question by:Seamus2626
  • 2
3 Comments
 
LVL 33

Expert Comment

by:Rob Henson
ID: 40232169
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
 
LVL 16

Expert Comment

by:Jerry Paladino
ID: 40232934
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
 
LVL 16

Accepted Solution

by:
Jerry Paladino earned 500 total points
ID: 40233932
If you want the above in a single statement...
ThisWorkbook.SlicerCaches("Slicer_Sales_Type41").ClearManualFilter

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question