• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA code to clear all slicer filters and select

Dokat

Member
Hi,

I have a very simple vba code where i want to first clear all filters in the slicer then select RB. Below is the code i am using but no success. can anyone help?

Code:
    ActiveWorkbook.SlicerCaches("Slicer_Manufacturer1").ClearManualFilter
   
    With ActiveWorkbook.SlicerCaches("Slicer_Manufacturer1")
   .SlicerItems("RB").Selected = True

End With
End Sub
 
What's the source of your slicer? Is it PivotTable based on Excel Table, PivotTable loaded from Data Model, or is it from OLAP?

Each scenario will have different code construction.

For DataModel version see thread below for reference.
http://chandoo.org/forum/threads/se...the-cell-values-excel-2013.30553/#post-183004

For PivotTable based on Excel Table/Range, refer to 2nd code in the post.
http://chandoo.org/forum/threads/vba-pivot-filtering-without-field-use.30561/#post-182240

Basically, you need to loop through each slicer items and turn off the ones you don't want.

Edit: You may be able to set all to False and then turn on for the one you want. Though haven't done it that way myself.
 
Back
Top