+ Reply to Thread
Results 1 to 4 of 4

combine Worksheet from different workbook in a single worksheet of a new workbook

  1. #1
    Registered User
    Join Date
    08-25-2015
    Location
    Kolkata, India
    MS-Off Ver
    2013
    Posts
    59

    combine Worksheet from different workbook in a single worksheet of a new workbook

    I have different workbooks with different names but there is one common Worksheet with the same name in all the different Workbooks. I want to merge that common Worksheet from all the workbook in a single Worksheet?

    Could anyone please help me with VBA code to solve thsi problem?

    Thanks and regards
    Nadim

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: combine Worksheet from different workbook in a single worksheet of a new workbook

    Perhaps a code like this?

    Please Login or Register  to view this content.
    You need to change the sPath to the folder where the files are found and you also need to change the sheet name "Input" to the common worksheet name for all the files.

    Alf

  3. #3
    Registered User
    Join Date
    08-25-2015
    Location
    Kolkata, India
    MS-Off Ver
    2013
    Posts
    59

    Re: combine Worksheet from different workbook in a single worksheet of a new workbook

    Thanks a ton Alf. Could you please help with one more thing that do I need to keep open all the workbooks from where the data is supposed to be copied? If yes, then there would be an issue that I have hundreds of such files and want the code to be run while the workbooks are closed.

    Thank you once again.
    Nadim

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: combine Worksheet from different workbook in a single worksheet of a new workbook

    At the moment the macro checks all files in a specific folder and opens every file, one file at the time. Then macro tries to activates the appropriate sheet. If sheet is not found system genrates a number 9 error and closes the file. It then jumps down to to line "skipper:" and opens the next file and again tries to activate the specified sheet.

    If sheet exists macro will copy all data from this sheet to ThisWorkbook Sheet1 (This Workbook is the workbook that contains this macro) The file is then closed and macro loops to check the next file in folder and will keep on doing so until every file is checked.

    do I need to keep open all the workbooks from where the data is supposed to be copied?
    No you don't macro will do that for you.

    If yes, then there would be an issue that I have hundreds of such files and want the code to be run while the workbooks are closed.
    ???? I really don't understand what you mean. If the file don't contain that specific sheet macro will close the file immediately and open the next file. If this file contains specific sheet, sheet will be copied and then the file will be closed.

    Alf

+ 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] Macro to Combine Multiple Workbook Data into Single Target Workbook
    By Jimbo42 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-27-2014, 08:26 PM
  2. Find workbook name and combine that workbook into exisiting worksheet column
    By ghladik in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2013, 02:23 PM
  3. Macro to combine many excel files into one workbook/worksheet
    By excel1983 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-19-2012, 02:32 PM
  4. Combine several workbook into one worksheet
    By dare2join in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-28-2012, 09:25 AM
  5. [SOLVED] Combine all worksheets into a single worksheet in a new workbook
    By ajm1949 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-02-2012, 08:20 AM
  6. Replies: 1
    Last Post: 10-27-2005, 03:05 PM
  7. e-mailing a single worksheet of a multiple worksheet (4) workbook
    By ppete83606 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-03-2005, 04:05 PM

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