+ Reply to Thread
Results 1 to 5 of 5

Creating multiple pivot tables from one PivotCache

Hybrid View

  1. #1
    Registered User
    Join Date
    04-10-2014
    Location
    Tallahassee, FL
    MS-Off Ver
    Excel 2010
    Posts
    98

    Creating multiple pivot tables from one PivotCache

    I need to understand the VBA needed to do it.

    I have the code to create the cache and the pivot tables on one page, but I don't want to create a new cache on each sheet. I want to be able to create one cache, then use that one cache to create many pivot tables.

    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=XSourceData, Version:=xlPivotTableVersion14).CreatePivotTable TableDestination:="'Test'!R5C1", TableName:="Test", DefaultVersion:=xlPivotTableVersion14
    Help?
    Last edited by Phixer; 07-09-2015 at 11:47 AM.

  2. #2
    Registered User
    Join Date
    04-10-2014
    Location
    Tallahassee, FL
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Creating multiple pivot tables from one PivotCache

    Wow, according to this no one has ever done this before, or been able to do this before. I am surprised.

    Guess I will be the first.

  3. #3
    Valued Forum Contributor Parth007's Avatar
    Join Date
    12-01-2014
    Location
    Banglore
    MS-Off Ver
    2010
    Posts
    879

    Re: Creating multiple pivot tables from one PivotCache

    hey Phixer,

    Please refer below link

    http://www.excelforum.com/excel-gene...ivotcache.html
    Regards
    Parth

    I appreciate your feedback. Hit * if u Like.
    Rules - http://www.excelforum.com/forum-rule...rum-rules.html

  4. #4
    Registered User
    Join Date
    04-10-2014
    Location
    Tallahassee, FL
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Creating multiple pivot tables from one PivotCache

    I need to do it using VBA, so there is no prompt that pops up to which one can say Yes.

    Right now the only way I know to do it is to copy the sheet, then alter the pivot table, which can be fraught with problems. Thus, I am seeking code to do it.

  5. #5
    Registered User
    Join Date
    04-10-2014
    Location
    Tallahassee, FL
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: Creating multiple pivot tables from one PivotCache

    AHA!

    Just because no one ever explained how to do it before, it CAN be done.

    ActiveWorkbook.PivotCaches(1).CreatePivotTable
    This will create a new pivot table, with pre-existing cache #1

    Want to know what details are in each cache?

    Sub CacheList()
    Dim pc As PivotCache
    Dim wsList As Worksheet
    Dim lRow As Long
    lRow = 2
    Set wsList = Worksheets.Add
    For Each pc In ActiveWorkbook.PivotCaches
      wsList.Cells(lRow, 1).Value = pc.Index
      wsList.Cells(lRow, 2).Value = pc.SourceData
      lRow = lRow + 1
    Next pc
    End Sub
    I hope this helps someone.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Creating a Master / Consolidated Pivot Tables from a multiple pivot tables
    By paradise2sr in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 12-12-2013, 02:28 AM
  2. Creating a Master / Consolidated Pivot Tables from a multiple pivot tables
    By paradise2sr in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 12-08-2013, 10:49 PM
  3. Creating Multiple Pivot tables
    By keithabailey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-10-2009, 03:26 PM
  4. Creating multiple pivot tables using VBA
    By Sam_Gregson in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-04-2009, 12:42 PM
  5. Multiple Pivot tables using single Pivotcache
    By doozer1979 in forum Excel General
    Replies: 1
    Last Post: 03-07-2008, 08:11 AM

Tags for this Thread

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