clear slicer

sanket_sk

Board Regular
Joined
Dec 27, 2016
Messages
140
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

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
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
 
Upvote 0
Solution

Forum statistics

Threads
1,214,653
Messages
6,120,748
Members
448,989
Latest member
mariah3

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