+ Reply to Thread
Results 1 to 2 of 2

Change source of pivot table dynamically based on sheet name

  1. #1
    Registered User
    Join Date
    08-09-2011
    Location
    Utrecht
    MS-Off Ver
    Excel 2013
    Posts
    48

    Change source of pivot table dynamically based on sheet name

    Hi all,

    Does anyone know if there is a vba code that changes the source of a pivot table dynamically based on sheet name?

    I have multiple data sheets in document 1. Every sheet is named after a specific month&year. If in document 1 a new data spreadsheet is created then I would like to create a pivot table spreadsheet in document 2 that automatically changes the sources of the pivots on that sheet accordingly to the data of document 1.

    Hope this explanation is clear.

    Happy to see your possible solutions,

    Best, Jeroen

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Change source of pivot table dynamically based on sheet name

    Hi,

    Not quite sure what you're getting at.

    The source for pivot tables should always be a dynamic range name so that as new data is added the PT can be refreshed to accomodate it, and I usually include an Activeworkbook.Refreshall line of code in some approriate event procedure, like say a SheetActivate procedure

    But I'm puzzled why you need many data sheets and many pivot tables. The smart thing to do is always hold all your data in a single database and worry about reporting it afterwards - which can usually be done fairly easily with a Pivot Table and appropriate Slicers, or some Advanced Data Filter.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ 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. [SOLVED] How can I dynamically change the format of the Y axis based on the source data
    By rmeister29 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 05-13-2023, 04:10 AM
  2. Change Pivot Table Data Source based on Dynamic Range
    By hamidxa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-16-2014, 04:46 PM
  3. Pivot table to refresh and source data to change using visible rows on a filtered sheet
    By papasmurfuo9 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-27-2014, 11:32 AM
  4. Pivot table - change data source to another pivot table in 2010
    By thesecretsanta in forum Excel General
    Replies: 4
    Last Post: 04-13-2011, 12:54 PM
  5. Replies: 1
    Last Post: 06-22-2010, 09:10 AM
  6. Replies: 1
    Last Post: 06-20-2010, 04:00 AM
  7. DYNAMICALLY data source for pivot table
    By Kalyan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-12-2006, 11:10 PM

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