Been stuck on this for a while and cant figure it out. I've looked online on various sites and havent found anything close to what i need. Here is what i need to do...
I have 6 Slicers in called "Quantrix" The slicers are called REG, DIRECTOR, AREA MANAGER, AOI, DMA, AG and CLOCK. I have 15 pivots (6 in Quantrix tab and 9 in a tab called "Pivots").
I have vba code to update all pivot cache (showing 1 pivot update below) ...
Here is the code to disconnect SLICER, update source data for ALL pivots then reconnects slicer... This works great but its ONLY 1 SLICERPHP Code:
Max = Sheets("eLink_Raw").Cells(Rows.Count, "A").End(xlUp).Row
Sheets("Quantrix").PivotTables("Quantrix 1").ChangePivotCache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
Sheets("eLink_Raw").Range("A1:AW" & Max).CurrentRegion _
, Version:=xlPivotTableVersion14)
How can i disconnects ALL Slicers, change source data for ALL Pivots then reconnect ALL slicers?PHP Code:
Dim vPivots As Variant
Dim i As Long
Max = Sheets("eLink_Raw").Cells(Rows.Count, "A").End(xlUp).Row
With ActiveWorkbook.SlicerCaches("Slicer_REG").PivotTables
If .Count = 0 Then Exit Sub
ReDim vPivots(1 To .Count)
For i = .Count To 1 Step -1
Set vPivots(i) = .Item(i)
.RemovePivotTable (.Item(i))
Next i
For i = 1 To UBound(vPivots)
If i = 1 Then
vPivots(1).ChangePivotCache _
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, _
SourceData:=Sheets("eLink_Raw").Range("A1:AW" & Max).CurrentRegion)
Else
vPivots(i).CacheIndex = vPivots(1).CacheIndex
End If
.AddPivotTable vPivots(i)
Next i
End With
I'm stuck.Any help will be greatly appreciated!
Bookmarks