+ Reply to Thread
Results 1 to 5 of 5

Change Pivot Cache

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    11-18-2007
    Posts
    111

    Change Pivot Cache

    In the past I have tried this but did not get help but I hope this time I get some kind of help because I am dying for help now. I have several pivot tables in my workbook with one data source. The data is extremely huge so I pulled the data from Access Database using EXTERNAL DATA SOURCE method in excel. So now I have my huge data in the pivot cache; what I would like to see is when user selects a Region from the pivot table, I want the user to be able to save the excel workbook with the Region he/she selected only. For instance, if the user selects East region, I want them to be able to save the whole workbook with East data only and exclude the rest. I have researched online and found some codes but could not figure out how to utilize it. I have attached small sample file for more details. Below is code I found on internet and it may be helpful to you. Thank in advance for your help
    link: http://www.contextures.com/xlPivot11.html

    Change the Pivot Cache
    
    'If you have created several pivot tables in a workbook, you may find it more 'fficient to use the same pivot cache for all the pivot tables. The following code will change the pivot cache for each pivot table in the workbook. 
    
    
    Sub ChangePivotCache()
    '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("Pivot").PivotTables(1).CacheIndex
        Next pt
      Next wks
    
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Change Pivot Cache

    You can't manipulate the actual pivotcache data.
    But....maybe this is an option...

    If you double-click a pivot table calculated value (from the far right column
    of the pivot table), Excel will insert a new sheet in the workbook that
    contains all of the data behind the dbl-clicked value.

    Using your posted example:
    Double-click the Grand Total for East.
    Excel inserts a new sheet with 65501 rows of backup data.
    Then you (or your user) could move that sheet into a new workbook and
    create a new pivot table based on that sheet.

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Contributor
    Join Date
    11-18-2007
    Posts
    111

    Re: Change Pivot Cache

    thanks for your response. But the problem with that is that some of my region have more than 70,000 rows, so that is why i am using a pivot table just to control the number of rows. thanks.

  4. #4
    Forum Contributor
    Join Date
    11-18-2007
    Posts
    111

    Re: Change Pivot Cache

    Where are the guru's? i know there is a solution to any problem. Pls. tell me how or at least give me some ideas. Thanks.

  5. #5
    Registered User
    Join Date
    07-19-2009
    Location
    Thane
    MS-Off Ver
    Excel 2000
    Posts
    1

    Re: Change Pivot Cache

    Quote Originally Posted by karinos57 View Post
    Where are the guru's? i know there is a solution to any problem. Pls. tell me how or at least give me some ideas. Thanks.

    How about creating VBA code on Pivot table Event?

+ Reply to Thread

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