clear slicer

sanket_sk

Board Regular
Joined
Dec 27, 2016
Messages
105
Office Version
  1. 365
Platform
  1. Windows
Hi All,

Hope you are doing good….

I have small doubt on the Clearing Pivot slicer, I am using VBA code to clear all slicers from Pivot however I don’t know how to apply it on the particular (One) slicer.

Scenario is

I have 5 Slicers on the “Dashboard” Sheet, All my Pivot Tables are available in the “Background” Sheet, now I want to clear only the “Region” Slicer ( No need to change the rest of the slicers), I am unable to figure out this change myself.

Could you please help me with code to clear specific slicer “Region”.


My Current code :-

Sub Clear_Slicers()

Dim oSlicerC As SlicerCache

Application.ScreenUpdating = False

For Each oSlicerC In ActiveWorkbook.SlicerCaches
If oSlicerC.FilterCleared = False Then oSlicerC.ClearManualFilter
Next oSlicerC

Application.ScreenUpdating = True


End Sub


Thanks & Regards,

Sanket
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Alex Blakenburg

Well-known Member
Joined
Feb 23, 2021
Messages
2,675
Office Version
  1. 365
Platform
  1. Windows
I am probably missing something. It should be just this:-

VBA Code:
Sub Clear_Slicers()

    Application.ScreenUpdating = False

    ActiveWorkbook.SlicerCaches("Slicer_Region").ClearManualFilter
    
    Application.ScreenUpdating = True

End Sub

If this "Slicer_Region" is not the name of you slicer then right click on your region slicer and select Slicer Settings (right at the bottom) and get the name from the dialogue box.

1629964164933.png
 
Solution
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,237
Messages
5,768,983
Members
425,507
Latest member
NrthnChrs

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
Top