+ Reply to Thread
Results 1 to 9 of 9

copy first sheet from different workbooks to target workbook

  1. #1
    Registered User
    Join Date
    09-11-2019
    Location
    Germany
    MS-Off Ver
    10
    Posts
    3

    Post copy first sheet from different workbooks to target workbook

    i have one common worksheet ("planning") from different workbooks (data1, data2, data3,...,etc), which i want to copy to target workbook to ("Master.xlsm"). the code which i have written, is only copy the sheet from first workbook (data1), and then after i get runtime error " 9: subscript out of range". please help me further.



    Please Login or Register  to view this content.
    Last edited by Pepe Le Mokko; 09-18-2019 at 02:45 AM.

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: copy first sheet from different workbooks to target workbook

    You need to remove this line from the loop
    Please Login or Register  to view this content.

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: copy first sheet from different workbooks to target workbook

    That said, there is also a problem with the loop, try
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    09-11-2019
    Location
    Germany
    MS-Off Ver
    10
    Posts
    3

    Re: copy first sheet from different workbooks to target workbook

    hello Fluff13

    thank you for the help.
    i have removed ThisWorkbook.Sheets("tr").Delete.
    but the Problem in Loop i didn't identify yet. it takes only worksheet from first workbook in the Folder. then i have the same error for next workbook.

  5. #5
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: copy first sheet from different workbooks to target workbook

    Hi
    Try to change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  6. #6
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: copy first sheet from different workbooks to target workbook

    @kaushalkbc

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    I did it for you this time. Please read forum rules

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: copy first sheet from different workbooks to target workbook

    Did you try the code I posted in post#3, or mohadin's suggestion in post#5?

  8. #8
    Registered User
    Join Date
    09-11-2019
    Location
    Germany
    MS-Off Ver
    10
    Posts
    3

    Re: copy first sheet from different workbooks to target workbook

    yes working perfectly.
    thank you very much

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: copy first sheet from different workbooks to target workbook

    Glad we could help & thanks for the feedback

+ 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] Copy data from Main sheet to target sheets according to row header and target sheet header
    By realrookie in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-31-2016, 07:26 AM
  2. Loop through workbooks and copy just the first sheet only to master workbook.
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-24-2014, 10:36 AM
  3. How to copy a sheet from one workbook as a sheet onto multiple workbooks
    By hld142 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2014, 10:11 AM
  4. vba to copy from multiple workbooks to a summary sheet in another workbook.
    By lisadykstra in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-22-2014, 03:36 PM
  5. Copy Sheet from one Workbook to Multiple Closed Workbooks
    By sflexi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-02-2013, 10:01 AM
  6. Copy a first sheet of a workbook in the first sheets of other workbooks
    By khracking in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-29-2012, 05:10 PM
  7. [SOLVED] VBA: Copy First Sheet of a List of Workbooks to New Workbook
    By DHartwig35805 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-12-2012, 06:05 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