+ Reply to Thread
Results 1 to 8 of 8

Merge Multiple Excel Workbooks with Macro

  1. #1
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Merge Multiple Excel Workbooks with Macro

    Hi all,

    I am stuck and would really appreciate your help in this regard, and I thank you in advance!:

    I need to write an app in excel that will merge multiple excel workbooks into one workbook (this could possibly be a macro / or vba UserForm containing the process that reads the workbooks and copies the data across).

    Important:
    The process must not create or copy duplicate records. I will have a unique identifier field (GUID) for each record in each workbook.

    I don't have anything to work off at this stage, so really appreciate your help!

    Thanks!

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Merge Multiple Excel Workbooks with Macro

    http://www.rondebruin.nl/win/s3/win008.htm
    https://sites.google.com/a/madrocket...xcelassistant/
    Last edited by JBeaucaire; 12-27-2019 at 04:44 AM.
    If solved remember to mark Thread as solved

  3. #3
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Merge Multiple Excel Workbooks with Macro

    Hi patel45

    Thanks for the share! Some great stuff on both these sites!

    I think I have found what I was looking for here: http://www.rondebruin.nl/win/s3/win008.htm, BUT

    I want the Macro process to verify that each record is unique (almost like a vlookup) whilst consolidating the sheets/workbooks. Do you have something like this, or could you perhaps give me some pointers?

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Merge Multiple Excel Workbooks with Macro

    you can use, after merge, Data, duplicates remove

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Merge Multiple Excel Workbooks with Macro

    Explaining further on what patel45 mentioned, you can consolidate all the data in the macro and then if your column is 1 which has the unique id based on which the rows can be checked for duplicates, use this code line -

    Please Login or Register  to view this content.
    Change the sheetname and columns accordingly.

    If you are facing a problem with doing the above, post your code here and we can help you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  6. #6
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Merge Multiple Excel Workbooks with Macro

    @arlu1201 and patel45, thanks, removing the duplicates works perfectly!

    I hope you guys would be able to assist me even further. I have tried the code myself, but get syntax errors etc. i would like to do the following:
    1. Set the range to the whole sheet and not just a section;
    2. Include the source Name of the workbook and sheet where the record was merged from;
    3. Instead of merging ALL workbooks in a directory, I would like to select the workbooks to be merged.

    I have attached my workbook with the code I currently have. Module 1 is the code for my button on sheet 1, as well as my Master code. FYI Module 2 contains code from Ron de Bruin with the functionality I need as listed above, i just cant get it combined correctly.

    Thanks a lot!
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Merge Multiple Excel Workbooks with Macro

    try this code
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Re: Merge Multiple Excel Workbooks with Macro

    Hi patel45,

    it does give me the option to select the files - thanks. But It does not contain the rest of the functionality I had. I still need the following:
    1. moving of consolidated workbooks to the "Import" directory;
    2. Importing the data to the "Master" sheet;
    3. Removing duplicates;
    4. Other selections.

    My Master code - Module 1 - works well, but I would like the following additions to make it better:
    1. Set the range to the whole sheet and not just a section;
    2. Include the source Name of the workbook and sheet where the record was merged from;
    3. Instead of merging ALL workbooks in a directory, I would like to select the workbooks to be merged.

+ 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] Excel 2007 : Macro to merge multiple workbooks
    By trisoldee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-13-2014, 03:18 PM
  2. How to merge multiple Excel workbooks into one file
    By mbogdanova in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-19-2012, 03:20 AM
  3. VBA to merge multiple Workbooks with multiple sheets retaining headers
    By LauraN1 in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 08-19-2010, 03:47 PM
  4. Replies: 3
    Last Post: 03-03-2010, 03:41 AM
  5. Macro to merge cells from multiple workbooks into one Master workbook
    By psmcltraining in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2009, 03:56 AM

Tags for this Thread

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