+ Reply to Thread
Results 1 to 5 of 5

Need help with a macro to consolidate data from multiple sheets into one

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    8

    Need help with a macro to consolidate data from multiple sheets into one

    I am trying to generate a detailed pivot table from multiple worksheets as I explained in in my other thread.

    However, I realized another solution (albeit a less elegant one) was to create a macro that simply copied and pasted the data from the different worksheets into one worksheet, and then I could create the pivot table from that sheet.

    The columns will the be same across all the sheets. However, the number of rows will vary, so would it be possible for the macro to copy as far down as data was entered (ie if I have data in columns A-F, just copy everything in A-F)? Or would this process be slow and would it be smarter to have the macro copy a set, say, columns A-F down to row 100 and hope that I won't have more than 99 entries?

    Also, if it is possible for the macro to copy all the columns, how would I make it skip the first row (the headers), since of course I don't want those being counted as data points?

    Attached an example to show what I want.
    ExampleMacro.xlsx

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need help with a macro to consolidate data from multiple sheets into one

    'MANY SHEETS TO ONE SHEET
    Here's a macro for merging data from multiple sheets into a "consolidation" sheet where the source sheets are the same layout.


    There's a sample file there, too, to make it easy to try it out.
    Last edited by JBeaucaire; 12-27-2019 at 10:23 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    01-25-2013
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Need help with a macro to consolidate data from multiple sheets into one

    That's exactly what I needed - thanks so much. Now I just have to figure it out how to edit the code to work for me haha.

    One more question though - how would I add in an exemption for a certain worksheet that I don't want consolidated? I have a sheet named "Master" with a pivot table in drawing data from the consolidated sheet - if I run the macro again, it adds the data from the pivot table sheet as well, which I don't want.
    Last edited by xdskyline; 02-15-2013 at 03:05 PM.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need help with a macro to consolidate data from multiple sheets into one

    Add to this line:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-25-2013
    Location
    California
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Need help with a macro to consolidate data from multiple sheets into one

    Thanks, that worked!

+ 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