Closed Thread
Results 1 to 7 of 7

Macro to Merge different Excel files into one

  1. #1
    Registered User
    Join Date
    01-27-2010
    Location
    SFO, USA
    MS-Off Ver
    Excel 2003
    Posts
    26

    Macro to Merge different Excel files into one

    Hello,

    I have 60 excel files with single sheet and I want to merge all 60 files into one excel file with 60 tabs. Is there any way to do it with macros ??

    Appreciate your help !!!

    Thanks,
    /Sukanya

  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: Macro to Merge different Excel files into one

    I have a standard Consolidation macro to do this. Edit the lines marked in red to your needs and it should do what you want.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 02-03-2010 at 12:27 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-27-2010
    Location
    SFO, USA
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Macro to Merge different Excel files into one

    Hi JBeucarie,

    Thanks so much for the code. It is working. But I want the sheet/tab names as actual sheet/tab names from all excel files. Currently It is taking file names as Tab names.

    Is that possible ?

    Thanks,
    /Sukanya

    Quote Originally Posted by JBeaucaire View Post
    I have a standard Consolidation macro to do this. Edit the lines marked in red to your needs and it should do what you want.

    Please Login or Register  to view this content.

  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: Macro to Merge different Excel files into one

    Of course, but are you 100% positive there will be no duplication of tab names between any two sheets? Absolutely 100%? It really makes me nervous opening 60 "unknown" files and moving in the only sheet in each and not using a sheet-naming method we know in advance won't result in duplicate sheet names.

    Please advise.

    I've highlighted in blue in my post above the line of code you could remove to have the sheets NOT be renamed prior to importing.

    NOTE: Please don't use the QUOTE button, it duplicates my post completely inside of yours for no reason. Just use the QUICK REPLY box below. Use the QUOTE if you do want to quote something specific I've said, but only leave in that portion, remove the rest.

    This makes thread much less cumbersome to read.
    Last edited by JBeaucaire; 02-03-2010 at 12:28 PM.

  5. #5
    Registered User
    Join Date
    05-16-2005
    Posts
    4

    Re: Macro to Merge different Excel files into one

    Hi Jerry, you macro is very helpful. I have one quick question. what if I just want to combine all the files into one single work sheet ( a new file but all on one tab)?

  6. #6
    Registered User
    Join Date
    07-06-2012
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    3

    Thumbs up Re: Macro to Merge different Excel files into one

    Hi Forum,

    Thanks so much for the code. It is working. Currently in the macro we have given a path to the files, so anyone using the macro has to create the same folders etc. I wanted to change it like once we run the macro it should ask for the path, like it should only point to dir and then we can select the path where the files are saved.

    Also I want to clear the color (unfill) on the final workbook.

    Is that possible ?

    Thanks,
    Abhilash
    Last edited by Abhilash B; 07-06-2012 at 10:29 AM.

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

    Re: Macro to Merge different Excel files into one

    Abhilash B,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    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]

Closed 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