Excluding a slicer from being reset

detweiler

Board Regular
Joined
Aug 2, 2013
Messages
60
I have looked, lo, through these internet meadows in hopes of finding something that speaks to a reasonable solution. I have inherited a workbook that I have been told needs a new, 5th, slicer added ( YAY! ), but need to exclude it from being reset when the other 4 slicers are.

The code currently being used I have seen on other posts,

Sub ClearMySlicers()
Dim Slcr As SlicerCache
For Each Slcr In ActiveWorkbook.SlicerCaches
Slcr.ClearManualFilter
Next
End Sub


but nothing that would say reset these 4 and not that one.

Thanks in advance for the help.
 
Last edited:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
UPDATE!

So, my initial post was looking to exclude the 5th slicer from being reset when the user selects the clear filters button, but found where the specific slicers are being called out in the code to be reset and put something like this together,

Sub ClearMySlicers()

ActiveWorkbook.SlicerCaches("Slicer_SlicerName01").ClearManualFilter
ActiveWorkbook.SlicerCaches("Slicer_SlicerName03").ClearManualFilter
ActiveWorkbook.SlicerCaches("Slicer_SlicerName04").ClearManualFilter

End Sub


to test the functionality, but the debugger would always stop at the first ActiveWorkbook line and couldn't get it to work.

If someone could let me know how far off I am with this line of thought would be appreciated.

Again, thanks in advance for the help.
 
Upvote 0
Your last macro should work, providing those are the names of the slicers. Here is another way of clearing all slicers except the 5th one:
Code:
Public Sub Clear_4_Slicers()
    
    Dim i As Long
    
    For i = 1 To 4
        ActiveWorkbook.SlicerCaches(i).ClearManualFilter
    Next
    
End Sub
 
Upvote 0
Solution
John,

Yeah, those are the actual names and no, I keep getting anInvalid procedure call or argument error when I run the filter code.

Once I figure out how to get the new slicer in and working, I'll use your suggestion - seems cleaner that listing each slicer out.

Thank you sir.
 
Upvote 0
John,

Did the trick ma'fren!

Interesting how frustratingly fun and laborious it is to automate the more simpler of worksheet tasks. And it never seems to end either, does it?

Thank you so very much.



This post can been deemed successfully resolved!
 
Last edited:
Upvote 0
@detweiler
Please take the time to read the rules, especially regarding cross posting
Thanks.
 
Upvote 0

Forum statistics

Threads
1,215,800
Messages
6,126,981
Members
449,351
Latest member
Sylvine

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top