+ Reply to Thread
Results 1 to 8 of 8

merge multiple worksheets based on values in column

  1. #1
    Registered User
    Join Date
    06-03-2014
    Posts
    4

    merge multiple worksheets based on values in column

    Hello all,
    I have a workbook with 17 sheets named "data_1" through "data_17". All of the headers are the same in each sheet. I need to create 3 new sheets with the same headers, and merge the 17 sheets based on values in column A.
    On every sheet column A has a value of 1 though 10. I need 1-3 to merge on the 1st new sheet, 4-6 to merge on the 2nd new sheet, and 7-10 to merge on the 3rd new sheet.
    Thank you for your help.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: merge multiple worksheets based on values in column

    Submit your workbook
    If you are happy with my response please click the * in the lower left of my post.

  3. #3
    Forum Contributor
    Join Date
    09-28-2014
    Location
    harbin,china
    MS-Off Ver
    2007
    Posts
    162

    Re: merge multiple worksheets based on values in column

    Hi
    see attach
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    06-03-2014
    Posts
    4

    Re: merge multiple worksheets based on values in column

    I am getting an error on Ln 18. Run-time error '9': Subscript out of range

  5. #5
    Forum Contributor
    Join Date
    09-28-2014
    Location
    harbin,china
    MS-Off Ver
    2007
    Posts
    162

    Re: merge multiple worksheets based on values in column

    Hi, sacwgar

    Submit your workbook pls. Don't be shy

  6. #6
    Registered User
    Join Date
    06-03-2014
    Posts
    4

    Re: merge multiple worksheets based on values in column

    I had to remove a lot of rows and sheets to get the size of my file below what's allowed. In reality the information on this sheet goes down to row 64,999. There are also 16 additional sheets (named Data_2 to Data_17), each going to row 64,999.
    When the merge is complete, each of the 3 new sheets will have between 300k to 400k rows.

    Thank you!
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: merge multiple worksheets based on values in column

    This accomplishes all the guidelines as you specified.

    Please Login or Register  to view this content.
    Edit: I noticed on your second workbook that there are potentially a lot of rows involved. Let me know if the code takes a long time to run. I can change it to be more efficient it would just take more of my time to do so. FWIW I don't think it should take that long with the code as written.

  8. #8
    Forum Contributor
    Join Date
    09-28-2014
    Location
    harbin,china
    MS-Off Ver
    2007
    Posts
    162

    Re: merge multiple worksheets based on values in column

    Lots of duplicate records in worksheet, if only unduplicated records are needed, use " UNION " instead of " UNION All " in program.
    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. [SOLVED] Merge cells in corresponding column based on similar values
    By Niclal in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 12-22-2014, 10:54 AM
  2. Merge Rows based upon Column A values
    By Nelkwagga in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-11-2014, 11:42 PM
  3. Merge/Consolidate Worksheets Based Upon Column Name
    By StrongEagle in forum Excel General
    Replies: 1
    Last Post: 09-03-2014, 03:06 PM
  4. Need to merge rows based on cell values on another column.
    By MrPilot in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-27-2014, 06:04 PM
  5. Merge column values in one row based on common key
    By ashokkumar2412 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-31-2014, 09:52 AM
  6. VBA to Merge Cells based on Other Column Values
    By meystingray in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-19-2014, 11:10 AM
  7. Merge values from column in one cell, based on duplicates in another column
    By Rawland_Hustle in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-24-2014, 11:04 AM

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