+ Reply to Thread
Results 1 to 2 of 2

Copy sheets from different workbooks to specific sheets in one workbook

  1. #1
    Registered User
    Join Date
    10-13-2011
    Location
    Zwijndrecht, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    1

    Copy sheets from different workbooks to specific sheets in one workbook

    In a sheet named "Master.xlsm", I run the following Macro below for 65 files. Now the code below is copied 65 times in which I have to change AA to AD or EA or GD and so forth.

    How can I create a loop that opens every available (!) OP2012-**-Versie1.xlsm and copies the contents of the sheet "programmaresultaten" to a specific sheet in Master.xlsm? See code below for the first of 65 files.

    Please Login or Register  to view this content.

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

    Re: Copy sheets from different workbooks to specific sheets in one workbook

    In a remote column (any unused column), enter the alphabets denoting the file names. Then using a loop, refer to the cell using a variable. Substitute the alphabet with the variable.

    for eg. if you enter all the 65 alphabets in column AA. So you need to have a loop to start from row 2 and proceed to row 66 (considering row 1 is your header for the column) one by one. So have a variable - maybe sname which will take the value from your column AA. (Sname=range("AA" & i).value). Then start your code with the For loop and in the file name, put in the "Sname" instead of your alphabet.

    Let me know if you have any difficulty in understanding the above.

+ Reply to 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