+ Reply to Thread
Results 1 to 4 of 4

VBA - Combine sheets in different files into workbook

  1. #1
    Registered User
    Join Date
    02-24-2017
    Location
    Minnesota
    MS-Off Ver
    2016
    Posts
    17

    VBA - Combine sheets in different files into workbook

    Please Login or Register  to view this content.
    I have a folder of different workbooks and I am trying to copy them all into one. I keep getting the error "Method 'Copy' of object'_Worksheet' failed" and I'm not sure how to fix it. This error comes up on the line:

    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: VBA - Combine sheets in different files into workbook

    Hello
    Try this code (I have changed the part of ws.Name because if the workbook has more than one sheet, this will cause an error (No two sheets with the same name)
    Generally the code is working now for me .. if there are any problems, it is better to upload sample of your workbooks ...
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: VBA - Combine sheets in different files into workbook

    Cross-Post at this link
    http://www.vbaexpress.com/forum/show...-into-workbook

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,719

    Re: VBA - Combine sheets in different files into workbook

    It might be wise to read up about cross posting.
    See here.
    https://www.excelguru.ca/content.php?184

    What happens if you change this
    Please Login or Register  to view this content.
    to this?
    Please Login or Register  to view this content.
    I quickly tried with a folder with workbooks and this works.
    Please Login or Register  to view this content.

+ 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. Macro to combine same-named sheets from multiple files
    By virsilens in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-13-2014, 12:05 AM
  2. How to combine a pool of excel files into one workbook?
    By Andy910104 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2014, 07:00 AM
  3. Replies: 14
    Last Post: 07-21-2013, 12:36 PM
  4. [SOLVED] combine files into Master workbook template
    By gr8wi9 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-13-2012, 12:38 AM
  5. Combine Sheets From All Files In A Directory
    By mikedamike in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-01-2012, 10:54 AM
  6. Merge/Combine Excel Sheets/Data/Files
    By nay in forum Excel General
    Replies: 0
    Last Post: 04-06-2009, 11:35 PM
  7. Combine CSV files into 1 Excel Workbook as sheets
    By JEFF in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2006, 06:10 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