+ Reply to Thread
Results 1 to 4 of 4

Macro to combine multiple sheets from multiple workbooks

  1. #1
    Registered User
    Join Date
    06-21-2010
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    8

    Macro to combine multiple sheets from multiple workbooks

    Hi There,
    I am looking for a macro that will open multiple workbooks and consolidate the worksheets on one tab. Each workbook will have the same number and named tabs (ie Sheet 1, Sheet 2) and the data will start in cell B5. In the end I am looking to consolidate all the Sheet 1's with a source range on one tab and all the Sheet 2's with a source range on another tab. I would also like only one header in the consolidated worksheet.

    I have attached a copy of what one workbook would look like.

    I have been using this code and it works okay if you have 1 tab, but it consolidates all rows when I want it to stop and the last cell with data in column B.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jeffreybrown; 10-10-2018 at 02:10 PM.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to combine multiple sheets from multiple workbooks

    Please wrap your code with code tags.
    The change you need to make are on the followings lines:

    Please Login or Register  to view this content.
    This below line copies all columns from A-R. You need to change a3 and r
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-24-2011
    Location
    New Hampshire, USA
    MS-Off Ver
    Excel 2007
    Posts
    36

    Re: Macro to combine multiple sheets from multiple workbooks

    thank you. Can we add a piece to the code that combines all Sheet 1's in one worksheet and all Sheet 2's in another?

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to combine multiple sheets from multiple workbooks

    First, the code does not loop around worksheets–it picks the only one sheet on a workbook. We can change the code to pick up more than one sheet, but this will slow the execution time as the code has to go through not only on each workbook but each sheet. There is also another miner issue: the code right now uses sheet(1)– it uses the index position of a sheet, so if we were to change it to look at sheet name, it will be another delay in execution.

    This is how I resolve the issue: since the names of each sheet are copied in to column A of the master sheet, it would much faster and easier to dump all sheets in to master as the code does now, then filter it by column A– using sheet(1) to separate them in to two sheets

+ 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. Replies: 3
    Last Post: 02-06-2018, 12:53 PM
  2. Vba/macro to combine multiple workbooks with multiple sheets into one workbook
    By ReshayM in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-03-2015, 01:00 PM
  3. Excel 2007 - Combine Multiple Workbooks into one Workbook Multiple Sheets
    By mab in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2014, 02:48 PM
  4. Combine several workbooks containing data in multiple sheets into a master Workbook
    By sunrize9 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-09-2014, 09:10 PM
  5. Required Macro for combine multiple workbooks which contains multiple worksheets
    By DHANASEKARAN in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-06-2013, 03:20 PM
  6. Combine multiple sheets of multiple workbooks in one sheet
    By Djibril69 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2013, 05:18 PM
  7. HELP TO COMBINE MULTIPLE SHEETS IN MULTIPLE WORKBOOKS
    By Eddy Stan in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-13-2006, 08:50 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