+ Reply to Thread
Results 1 to 7 of 7

combine several spreadsheets into one

  1. #1
    Registered User
    Join Date
    06-09-2009
    Location
    UAE
    MS-Off Ver
    Excel 2013
    Posts
    20

    Smile combine several spreadsheets into one

    I am so frustrated to combine several spreadsheets into all in one, and seperate all in one spreadsheet into several with the same header frenquently. Pls check the attached example excel spreadsheet., could anyone teach me how to program in vba to achieve the result as above?

    Many thanks.
    Attached Files Attached Files
    Last edited by david2005wang; 06-26-2009 at 03:31 PM.

  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: combine several spreadsheets into one

    Here are two simple array macros to consolidate all to one sheet, or parse all to one out to the vendor sheets.
    Please Login or Register  to view this content.
    How to use the macros:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save your sheet

    The macros are installed and ready to use. Press Alt-F8 and select them from the macro list.
    _________________
    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
    06-09-2009
    Location
    UAE
    MS-Off Ver
    Excel 2013
    Posts
    20

    Re: combine several spreadsheets into one

    Hi, JBeaucaire,

    Thanks for your programming.

    It should be worked I believe. However, when I ran this program either in Debug status or select the Macro in the M.S. spreadsheet, and the spreadsheet popup " 9-0 subscript out of range" and then the program stop.

    I trust you have tried in your computer about this program.

    by thy way, My M.S is 2003 version.

    Any clues will be highly appreciated.

    Regards

    Wang

  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: combine several spreadsheets into one

    That error usually means the macro can't find a specific sheet. If you've tried this sheet on a different one that the one you uploaded, it is expecting to find the same sheets.

    Try in the attached version of your original file.

    The two macros are "Consolidate" and "Parse".
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-09-2009
    Location
    UAE
    MS-Off Ver
    Excel 2013
    Posts
    20

    Re: combine several spreadsheets into one

    Dear Mr. JBeaucaire, Thanks so munch for you prompt response, really.
    What you said is exactly right.
    I found the reason that your program don't work for my case.
    When I delete the sub-spreadsheets, such as "AEG " "ARP"ARVBEACPMEFXKERMITNUOPTESNDTFS"TTE",
    then I run the macro again and click "Parce", the error " 9-0 subscript out of range " popup again; Or, When I delete the "all in on "spreadsheet, and click " consolidate" with the same situiation.

    I think there much a way to automactically delete the original, if exist, sub-spreadsheets,and setup new sub-spreadsheets everytime, when I click "Parce", And, automactically delete the original, if exist, "All in one" spreadsheets,and setup new one.

    Thanks for you further assisatance.

    Regards

    P.S. could you leave you email address in order to "bother" you again in the future.

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

    Re: combine several spreadsheets into one

    Please do not delete the sheets. As stated earlier, it is expected that those sheets will be there. The macros clear away the old data on those sheets, so you do not need to delete them.

    Consolidate "clears the data from the All in one sheet" without deleting the sheet itself. This way we don't have to recreate headers and stuff.

    Parse clears the individual sheets of data without deleting the sheets and then parses out the data from ALL IN ONE back out to all the sheets.

  7. #7
    Registered User
    Join Date
    06-09-2009
    Location
    UAE
    MS-Off Ver
    Excel 2013
    Posts
    20

    Re: combine several spreadsheets into one

    coreect. through what you said, it works.

    thanks.

+ 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