Results 1 to 3 of 3

Consolidate existing Pivot Tables to use one cache

Threaded View

  1. #1
    Forum Contributor
    Join Date
    04-14-2008
    Location
    Fort Collins, Co
    MS-Off Ver
    2016
    Posts
    107

    Exclamation Consolidate existing Pivot Tables to use one cache

    All my pivots use the same exact data source. I tried to be good about copying and pasting pivots, but I'm afraid some pivots were not created that way.

    I found this code on the web:

    
    Sub ChangePivotCache()
    'pivot table tutorial by contextures.com
    'change pivot cache for all Pivot Tables in workbook
    Dim pt As PivotTable
    Dim wks As Worksheet
    
      For Each wks In ActiveWorkbook.Worksheets
        For Each pt In wks.PivotTables
            pt.CacheIndex = Sheets("ALLRATES").PivotTables(1).CacheIndex
        Next pt
      Next wks
    
    End Sub
    But this does not work. I'm using the sheet ALLRATES (has two pivot tables PivotTable1 and PivotTable2). I just want to make every pivot in my workbook use the same cache as PivotTable1 in the ALLRATES worksheet.
    Last edited by 4am; 02-18-2011 at 01:28 PM.
    Is That Your Spreadsheet Or Did Your Database Just Throw Up?


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1