+ Reply to Thread
Results 1 to 19 of 19

Can't create a Master Pivot table from multiple worksheets in the same workbook

  1. #1
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Can't create a Master Pivot table from multiple worksheets in the same workbook

    I am trying to create a macro that would create a pivot table from the data from different worksheets. I tried creating a pivot table using the "ALT+D+P" wizard but I can't get the pivot table formatted that way I would like to. Is there a way to create a macro that would create a master pivot table using the data from the worksheets in this workbook and in the same format as the pivot tables on the individual worksheets? Look forward to your assistance. I have attached the sample workbook I have been using for all my my testing and creating macros.

    Thanks!
    Attached Files Attached Files

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    you can create a pivot table from multiple consolidation ranges. don't use any page fields and don't include the RSA column in the ranges, and then add a calculated item (not field) to the column field to create your third column.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    Except, I want to be able to drill down and see which RSA's are open and the QTY stilled for any Open RSA relating to the Item Number.

  4. #4
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    I want to do this without having to scroll through all of the worksheets and figuring out what is still owed.

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    in that case you will need to actually create one table with all your data. personally I would recommend that anyway since it will make all reporting much simpler.

  6. #6
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    That is what i am trying to do but when I use the wizard with the shortcut keys "Although+D+P", the format is not right...so how do I create this "master" pivot table?

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    I mean physically create one table with all your source data in it, not one pivot table.

  8. #8
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    Are you saying to copy the data from each worksheet to a "master" worksheet and then create a pivot table from that?

  9. #9
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    yes, I am. always better to have one table for reporting purposes if at all possible. you can always filter it to view specific RSAs for example.

  10. #10
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    Hi dwhite30518,
    See if this code isn't what you need to put your data on the Summary (first) worksheet.
    Please Login or Register  to view this content.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  11. #11
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    That is what I am trying to create...One pivot table for reporting. There must be another way to do the same thing without having to manually copy each worksheet and then paste to a master worksheet. It would take a while considering the number of worksheets I am working with as well as the fact of having to copy data all over again every time I make a change to the original worksheet. There has to be a way to create a macro that will get the data from all of the worksheets and then create the pivot table in a similar format as the pivot tables on the individual worksheets.

  12. #12
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    Marvin,

    If I am reading this code right, this code will copy the data from one of the worksheets and then paste to the "Summary" worksheet...right?

  13. #13
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    Hi,

    Have you heard of DNR? In your code for the pivot table you can use named ranges for your data instead of needing to select each individually. I thought you wanted to copy all the data to the first sheet. My code above will do that.

    See http://www.gilliganondata.com/index....your-charts-2/ or
    http://excelnoob.blogspot.com/2010/0...ed-ranges.html

    Perhaps you need this Excel tool to accomplish your task.

  14. #14
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    dynamic named ranges will still involve a consolidation range-based pivot table and that won't work. your options as I see them are
    1. have one table of data. this is, imo, the best option (I would replace the other sheets completely)
    2. use ado to extract the data from each sheet into a recordset and populate the pivot table with that. however there are memory leak errors when running sql commands on an open workbook.

    I don't think powerpivot would allow you to construct a union query to get all the data in one table but I could be wrong.

  15. #15
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    Hey JosephP,

    "Won't Work" is a little vague for me. If you consolidate all the data onto the first sheet using my above code then you don't have consolidation problems. Then you are only limited by what Pivot Tables can do. Is the "Won't Work" because you can't figure the VBA to do the entire problem with a single click?

  16. #16
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    Let me clarify what I would like to do...I want to create a "Master" Pivot table on the summary worksheet that will act like a report showing me how many devices are due back to the customer. I would like to create this pivot table without having to copy each worksheet to a "Master" worksheet and create the pivot table from that. The individual worksheets get data added on a daily basis and if I use this copy method, it would just be time consuming. Is there a way that I can take the ranges from each worksheet and create a single pivot table on the summary tab using a VBA and have a refresh button to refresh the data every time I add data?

  17. #17
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    Hey,

    Clicking a button to run the macro I gave you might take a minute to accumulate all the sheets to the first. Your "too much time" comment is a little harsh. It will take you 100 times longer to create a VBA macro dealing with multiple sheets and multiple ranges than running my macro to get them into a single table. You can modify my macro to clear the contents of Sheet1 before you start.

    I think you are thinking you need to manually copy and paste each sheet. Just run my macro and it will do ALL sheets. It will be fast. I can speed it up using Application.ScreenUpdating = False if you think it takes too long.

  18. #18
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    @Marvin
    "Won't work" related to your comment about dynamic named ranges, not your code (since I've already said that one table of data is needed)

    @dwhite30518,
    your requirement is clear, I think- that is what we have been trying to address. barring the ADO (or possibly querytable) option, you will have to copy the data if a pivot table based on consolidation ranges won't do, which you have indicated it won't. why is automated copying of the data too time consuming?

  19. #19
    Forum Contributor
    Join Date
    05-13-2012
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2010
    Posts
    378

    Re: Can't create a Master Pivot table from multiple worksheets in the same workbook

    My biggest concern, is making sure that I can try and keep this file as small as possible but still have all of the relevant data.

    I am using the pivot tables as part of the formatting of the workbook so deleting them I don't think would be a good idea.

    A couple of things with the code you provided previously...

    1. If I wanted this code to hide the "Master" sheet with this data, how can I do that?

    2. Is there a way to refresh this data when changes are made or do I just need to add code to clear the sheet and then copy the data?

+ 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