Visual Basic Classic
--
Questions
--
Followers
Top Experts
I'm doing the following in my workbook.
1. Using OLAP Slicers to Filter data that resides in PowerPivot. Less than 500 records worth of data.
2. Passing the Selections in these OLAP-Slicers back to some Non-OLAP-Slicers (via the code below) which enables me to "ShowDetails" if using multiple filtering criteria. The Non-OLAP-Slicer are connected to a regular Pivot Table that summarizes a Regular Excel Table. FYI Having the Non-OLAP Slicers connect to a Pivoted Summary of the Excel Table ran faster than having the OLAP slicer selections passed directly to slicers connected to the Excel Table.
3. It takes about 3-5 seconds to pass any selection made in the OLAP Slicers to the Non-OLAP slicers (I am "okay" with this)
4. I'm using the 2nd bit of code below to reset all of the OLAP SlicerCaches on the their respective worksheet; this obviously triggers the Pivot table change event and as a consequence takes around 21-25seconds to run.
I'd like to improve the performance of 4, and if possible 3. Thus far, I've tried to create Calculated Fields in PowerPivot and put those into the PivotTable(s) that are being refreshed when the PivotChange event occurs (as opposed to, having the PivotTable itself calculate Sums, Averages, etc...) This has helped some. Is there anything else I can do?
OLAP to Non-OLAP Slicer Sync Code:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim scOLAP As SlicerCache
Dim scList As SlicerCache
Dim sO As Slicer
Dim sL As Slicer
Dim si As SlicerItem
Dim i As Integer
Dim svalue As String
Dim ar() As String
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_RegionCode")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_RegionCode2")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[RegionCode].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_OpLocationCode")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_OpLocationCode2")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[RegionCode].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_AvailableAsset")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_AvailableAsset2")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[RegionCode].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_StratMissionSet")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_StratMissionSet2")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[RegionCode].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_TOMISTypeClean")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_TOMISTypeClean2")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[RegionCode].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_AssetSuitability")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_AssetSuitability2")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[RegionCode].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_PastPerformance")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_PastPerformance2")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[RegionCode].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_Authorization")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_Authorization2")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[RegionCode].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_Priority")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_Priority2")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[RegionCode].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Reset Slicers on Active Worksheet Code:
Public Sub ResetSlicers(ws As Worksheet)
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim sc As SlicerCache
Dim scs As SlicerCaches
Dim slice As Slicer
Set scs = ws.Parent.SlicerCaches
If Not scs Is Nothing Then
For Each sc In scs
For Each slice In sc.Slicers
If slice.Shape.Parent Is ws Then
sc.ClearManualFilter
Exit For 'unnecessary to check the other slicers of the slicer cache
End If
Next slice
Next sc
End If
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Corrected SlicerSync Code:
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim scOLAP As SlicerCache
Dim scList As SlicerCache
Dim sO As Slicer
Dim sL As Slicer
Dim si As SlicerItem
Dim i As Integer
Dim svalue As String
Dim ar() As String
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_RegionCode")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_RegionCode1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[RegionCode].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_OpLocationCode")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_OpLocationCode1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[OpLocationCode].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_AvailableAsset")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_AvailableAsset1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[AvailableAsset].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_StratMissionSet")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_StratMissionSet1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[StratMissionSet].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_TOMISTypeClean")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_TOMISTypeClean1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[TOMISTypeClean].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_AssetSuitability")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_AssetSuitability1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[AssetSuitability].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_NewRequirement")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_NewRequirement1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[NewRequirement].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_Authorization")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_Authorization1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[Authorization].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_Priority")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_Priority1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
ReDim ar(UBound(scOLAP.VisibleSlicerItemsList))
For i = 1 To UBound(scOLAP.VisibleSlicerItemsList)
svalue = Replace(Replace(scOLAP.VisibleSlicerItemsList(i), "[TablePPCleanUORC].[Priority].&[", ""), "]", "")
ar(i) = svalue
Next
For Each si In scList.SlicerItems
If UBound(Filter(ar, si.SourceName)) < 0 Then
si.Selected = False
End If
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Custom Function:
Function CheckSelectedSI(testFor As String, sc As SlicerCache)
Dim k As Integer
For k = 1 To UBound(sc.VisibleSlicerItemsList)
If testFor = Replace(Replace(sc.VisibleSlicerItemsList(k), "[TablePPCleanUORC].[RegionCode].&[", ""), "]", "") Then
CheckSelectedSI = True
Exit For
End If
Next
For k = 1 To UBound(sc.VisibleSlicerItemsList)
If testFor = Replace(Replace(sc.VisibleSlicerItemsList(k), "[TablePPCleanUORC].[OpLocationCode].&[", ""), "]", "") Then
CheckSelectedSI = True
Exit For
End If
Next
For k = 1 To UBound(sc.VisibleSlicerItemsList)
If testFor = Replace(Replace(sc.VisibleSlicerItemsList(k), "[TablePPCleanUORC].[AvailableAsset].&[", ""), "]", "") Then
CheckSelectedSI = True
Exit For
End If
Next
For k = 1 To UBound(sc.VisibleSlicerItemsList)
If testFor = Replace(Replace(sc.VisibleSlicerItemsList(k), "[TablePPCleanUORC].[StratMissionSet].&[", ""), "]", "") Then
CheckSelectedSI = True
Exit For
End If
Next
For k = 1 To UBound(sc.VisibleSlicerItemsList)
If testFor = Replace(Replace(sc.VisibleSlicerItemsList(k), "[TablePPCleanUORC].[TOMISTypeClean].&[", ""), "]", "") Then
CheckSelectedSI = True
Exit For
End If
Next
For k = 1 To UBound(sc.VisibleSlicerItemsList)
If testFor = Replace(Replace(sc.VisibleSlicerItemsList(k), "[TablePPCleanUORC].[AssetSuitability].&[", ""), "]", "") Then
CheckSelectedSI = True
Exit For
End If
Next
For k = 1 To UBound(sc.VisibleSlicerItemsList)
If testFor = Replace(Replace(sc.VisibleSlicerItemsList(k), "[TablePPCleanUORC].[NewRequirement].&[", ""), "]", "") Then
CheckSelectedSI = True
Exit For
End If
Next
For k = 1 To UBound(sc.VisibleSlicerItemsList)
If testFor = Replace(Replace(sc.VisibleSlicerItemsList(k), "[TablePPCleanUORC].[Authorization].&[", ""), "]", "") Then
CheckSelectedSI = True
Exit For
End If
Next
For k = 1 To UBound(sc.VisibleSlicerItemsList)
If testFor = Replace(Replace(sc.VisibleSlicerItemsList(k), "[TablePPCleanUORC].[Priority].&[", ""), "]", "") Then
CheckSelectedSI = True
Exit For
End If
Next
End Function
PivotChange event
Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim scOLAP As SlicerCache
Dim scList As SlicerCache
Dim sO As Slicer
Dim sL As Slicer
Dim si As SlicerItem
Dim i As Integer
Dim j As Integer
Dim l As Integer
Dim svalue As String
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_RegionCode")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_RegionCode1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
For j = 1 To scList.SlicerItems.Count
scList.SlicerItems(j).Selected = CheckSelectedSI(scList.SlicerItems(j).SourceName, scOLAP)
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_OpLocationCode")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_OpLocationCode1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
For l = 1 To scList.SlicerItems.Count
scList.SlicerItems(l).Selected = CheckSelectedSI(scList.SlicerItems(l).SourceName, scOLAP)
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_AvailableAsset")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_AvailableAsset1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
For l = 1 To scList.SlicerItems.Count
scList.SlicerItems(l).Selected = CheckSelectedSI(scList.SlicerItems(l).SourceName, scOLAP)
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_StratMissionSet")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_StratMissionSet1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
For l = 1 To scList.SlicerItems.Count
scList.SlicerItems(l).Selected = CheckSelectedSI(scList.SlicerItems(l).SourceName, scOLAP)
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_TOMISTypeClean")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_TOMISTypeClean1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
For l = 1 To scList.SlicerItems.Count
scList.SlicerItems(l).Selected = CheckSelectedSI(scList.SlicerItems(l).SourceName, scOLAP)
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_AssetSuitability")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_AssetSuitability1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
For l = 1 To scList.SlicerItems.Count
scList.SlicerItems(l).Selected = CheckSelectedSI(scList.SlicerItems(l).SourceName, scOLAP)
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_NewRequirement")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_NewRequirement1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
For l = 1 To scList.SlicerItems.Count
scList.SlicerItems(l).Selected = CheckSelectedSI(scList.SlicerItems(l).SourceName, scOLAP)
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_Authorization")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_Authorization1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
For l = 1 To scList.SlicerItems.Count
scList.SlicerItems(l).Selected = CheckSelectedSI(scList.SlicerItems(l).SourceName, scOLAP)
Next
Set scOLAP = ActiveWorkbook.SlicerCaches("Slicer_Priority")
Set scList = ActiveWorkbook.SlicerCaches("Slicer_Priority1")
scList.ClearManualFilter
Set sO = scOLAP.Slicers(1)
Set sL = scList.Slicers(1)
For l = 1 To scList.SlicerItems.Count
scList.SlicerItems(l).Selected = CheckSelectedSI(scList.SlicerItems(l).SourceName, scOLAP)
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Rgds/gowflow
Regarding Jim's code, no after doing some testing disabling events and setting the pivot table to manual update did not speed up the resetting of all slicers.
I've attached two workbooks,
One with the original code and one with the custom functions to see if y'all can improve. However, you're not going to see the same 40sec processing time that I'm seeing during reset in my real workbook because the data in PowerPivot is fake/dummy. However, perhaps you'll be able to spot something.
I think I might have a clue for you, in the real workbook there are 9 slicers. ScreenUpdating is false at the start of the code, therefore I should only see the various pivot charts and tables the slicers connect to updated once at the completion of the code. However that is not the case, I see the screen update by the number of slicers that do not have "all" slicer items selected minus 1. For example, if 4 slicers have selections made in them, I will see the screen update 3 times before the reset is complete.
That leads me to believe the code is looping, which at first I thought was tied to the Worksheet_PivotTableUpdate
ActiveSheet.PivotTables("Y
Anyway here are the files...

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
gowflow






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
https://support.office.com/en-CA/article/Start-the-Power-Pivot-in-Microsoft-Excel-add-in-a891a66d-36e3-43fc-81e8-fc4798f39ea8
If on 2010: http://www.microsoft.com/en-us/download/details.aspx?id=7609
Well let me see your problem before I go on a venture.
Your problem is that when you activate the button Reset Slicers you find the code too slow right ?
or it is something else ??
gowflow
To me there appears to be a loop occurring because of the Screen Updating behavior I mentioned earlier.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
However, downside to this is when I run JUST the code under the pivottable change event, ala when selecting items from the 9 slicers and I'm not interested in resetting them. What was 3-4 seconds before is now 13-14secs.
Is there anyway to "step through" code that is triggered by an event, to get a better idea of whats happening?
gowflow






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
But the idea is correct, perhaps the best approach if the goal is to speed up the Reset code is in addition to disabling Events telling the reset macro to .ClearManualFilters on all of the non-OLAP slicers. This way they would be by in "sync" with the OLAP slicers with out actually using the Pivot Table change event code to sync them...?
EDIT: disregard the above, I forgot that my sample-workbook-reset-code

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
Visual Basic Classic
--
Questions
--
Followers
Top Experts
Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.