+ Reply to Thread
Results 1 to 4 of 4

VB Macro for multiple Pivot table in different tabs

  1. #1
    Registered User
    Join Date
    12-20-2015
    Location
    srilanka
    MS-Off Ver
    2007
    Posts
    9

    VB Macro for multiple Pivot table in different tabs

    Dear Experts ,

    Can anyone explain me to write macro with looping to create multiple Pivot table in different tabs from one pivot source. I have attached excel files and insert two pivot tables as I required.
    I have variable from X1 to X33 in my rows and I need pivot table Name in Row label, Time in Colum label and X1 in Values Field (value filed must be summarized as Sum)
    I need 33 Pivot tables in different tabs while keeping constant Row label and Colum label as name and time , and changing value field (value filed must be summarized as Sum) from X1 to X33.

    I have inserted two pivot table for get it clear my requirement.

    Thanks and Regards.

    NNNN
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: VB Macro for multiple Pivot table in different tabs

    If this is a one time requirement, then there is a relatively easy way to do it without VB. I see that you have the same pivot table structure, but include a different x1, x2, ... as the value in the pivot table.

    Select the two sheets on which you already have the pivot table and right click the mouse. Once of the options on the menu is Move or Copy. Select Copy and click on a position after which you would like to create the new sheets. Check the box that says Create a Copy and click OK. You now have two duplicate sheets. Select the four sheets (two original and two copies) and repeat the process. You now have 8 copies and so on.

    Then go back rename the sheets and click on the appropriate value you want to display in each sheet.

    I can suggest an different approach: create one sheet, and give the user a drop down box to select which variable to summarize. This will take some VB coding. Let me know if you are interested in this approach: I can give it a try.

  3. #3
    Registered User
    Join Date
    12-20-2015
    Location
    srilanka
    MS-Off Ver
    2007
    Posts
    9

    Re: VB Macro for multiple Pivot table in different tabs

    Dear Dflak ,

    Thank you for your replay . This is part of daily repitive report . So VB approch is more suitable . Pls go head with your second option .

    Thanks .
    NNNN

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: VB Macro for multiple Pivot table in different tabs

    Here is a copy of your sample file. I truncated some of the data for the purposes of testing.

    The first thing I did was highlight the range of headers (C1:L1) and gave it a name: FieldList. I use this as a source of a data validation in cell B1. This assures that you must select a good name. You will have to select the column headers on your final spreadsheet and give it a name.

    I made a change event on the page containing the pivot table that fires when this dropdown list is changed.
    Please Login or Register  to view this content.
    This event calls the subroutine that changes the pivot table. It turns off all values and turns back on just the value you want.
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. Macro help: Separating data into tabs and creating a table of content of those tabs
    By AntiPivotTable in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-15-2015, 11:57 AM
  2. Split Sum of Value in Pivot Table using Multiple Tabs
    By ghostexcel in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 04-14-2014, 06:26 AM
  3. pivot table placed in multiple tabs within a workbook?
    By Nick123456 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 09-14-2013, 01:39 AM
  4. [SOLVED] need macro or anything to link multiple pivot table
    By koi in forum Excel General
    Replies: 1
    Last Post: 10-13-2012, 06:47 AM
  5. Replies: 6
    Last Post: 02-01-2012, 05:29 PM
  6. Pivot table across multiple tabs in a workbook
    By mbrant in forum Excel General
    Replies: 4
    Last Post: 03-09-2007, 01:19 PM
  7. Help: Create Pivot Table from multiple tabs in a Spreadsheet
    By AUDIOBLASTER in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-04-2007, 12:30 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