alemarquezr
New Member
- Joined
- Sep 15, 2015
- Messages
- 12
Hi all,
I have a file connected to a cube and I created the following code to add Pivot Tables to my slicers automatically BUT every time one pivot is added EXCEL is creating "Running OLAP Query".
PROBLEM: I would like to stop that query and refresh my pivots only when all pivots have been added to all my slicers.
I appreciate your support on this, Thanks!
************************************************************************
Sub ConnectAllSlicerPivots()
Dim MySheet As Worksheet
Dim MyPivot As PivotTable
Dim slCaches As SlicerCaches
Dim slCache As SlicerCache
Dim oSht As Worksheet
Set slCaches = ThisWorkbook.SlicerCaches
For Each slCache In slCaches
For Each MySheet In ActiveWorkbook.Worksheets
For Each MyPivot In MySheet.PivotTables
Debug.Print "To Connect:", MyPivot, "in", slCache.Name
slCache.PivotTables.AddPivotTable MyPivot
Next MyPivot
Next MySheet
Next slCache
MsgBox ("Slicers connected: Graphs Updated")
************************************************************************
BR/ AM
I have a file connected to a cube and I created the following code to add Pivot Tables to my slicers automatically BUT every time one pivot is added EXCEL is creating "Running OLAP Query".
PROBLEM: I would like to stop that query and refresh my pivots only when all pivots have been added to all my slicers.
I appreciate your support on this, Thanks!
************************************************************************
Sub ConnectAllSlicerPivots()
Dim MySheet As Worksheet
Dim MyPivot As PivotTable
Dim slCaches As SlicerCaches
Dim slCache As SlicerCache
Dim oSht As Worksheet
Set slCaches = ThisWorkbook.SlicerCaches
For Each slCache In slCaches
For Each MySheet In ActiveWorkbook.Worksheets
For Each MyPivot In MySheet.PivotTables
Debug.Print "To Connect:", MyPivot, "in", slCache.Name
slCache.PivotTables.AddPivotTable MyPivot
Next MyPivot
Next MySheet
Next slCache
MsgBox ("Slicers connected: Graphs Updated")
************************************************************************
BR/ AM