Change pivot cache from "pivot table" to "power pivot"

lovallee

Board Regular
Joined
Jul 8, 2002
Messages
220
Good day

I have an Excel file with about 50 "regular" pivot tables feeding from a single "regular" pivot cache.
Now I just created a Power Pivot data model using the same table as my exisiting "regular" pivot tables and would like my 50 pivot tables to feed from the new PowerPivot data model.
The pivot cache underlying the PowerPivot data model has CacheIndex = 6.
The following code works to change to the pivot cache between two "regular" pivot caches but fails when the new pivot cache is a PowerPivot cache.
(Error: Run-time error '1004' Application-defined or object-defined error)

Question: is there a way not to have to manually recreate all 50 pivot tables so that they feed from the PowerPivot data model? Thanks!

VBA Code:
Sub MassChangePivotCacheWorksheetLevel()
Dim pt As PivotTable
Dim wks As Worksheet

   aWbkName = ActiveWorkbook.Name
   aShtName = ActiveSheet.Name

    For Each pt In ActiveSheet.PivotTables
        pt.CacheIndex = 6
    Next pt

End Sub
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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