+ Reply to Thread
Results 1 to 6 of 6

Open and copy workbooks into single workbook

  1. #1
    Registered User
    Join Date
    07-11-2020
    Location
    Arizona, United States
    MS-Off Ver
    Office 2016
    Posts
    7

    Post Open and copy workbooks into single workbook

    Hello,

    I am relatively new to VBA but understand basic coding. I currently have code that will open a file location and open all the files within a folder based on userform entries. What I really need help with is how to copy the data from the first sheet of each of the opened files and paste them in their respective sheets in one workbook. For example:
    I open all files each named: “1”, “2”, “3”, etc. The number of files being opened is varying.
    I want to copy the data from workbook “1” and paste the data into Cell A5 of sheet 3 in a separate workbook (3 is not the name of the sheet but the sheet number)
    Then I want to copy the data from workbook “2” and paste it into Cell A5 of sheet 4
    And so on...
    The number of sheets created in the single workbook is based on the number of files in that location so there will always be enough sheets in the other workbook.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,609

    Re: Open and copy workbooks into single workbook

    You have not shown the code, but the general idea would be:

    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    07-11-2020
    Location
    Arizona, United States
    MS-Off Ver
    Office 2016
    Posts
    7

    Re: Open and copy workbooks into single workbook

    Apologies for not showing it in the original post. This is the code I have so far:

    Please Login or Register  to view this content.
    At this point, I have all files open and new sheets created in my workbook (which we can call "Testing" for now).
    Last edited by TacoSpagheti; 07-11-2020 at 11:47 AM.

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,609

    Re: Open and copy workbooks into single workbook

    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

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,609

    Re: Open and copy workbooks into single workbook

    How about mixing your code with suggestion from post #2, like:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    07-11-2020
    Location
    Arizona, United States
    MS-Off Ver
    Office 2016
    Posts
    7

    Re: Open and copy workbooks into single workbook

    Yes! That worked. Thank you so much. :D

+ 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 copy one column from several workbooks into a single workbook
    By dreindorf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-25-2015, 03:33 AM
  2. Macro to get values from multiple closed workbooks into single open workbook
    By aman2059 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-10-2015, 08:36 AM
  3. Import data from several closed workbooks to a single sheet in an open workbook
    By drewship in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-04-2013, 06:35 AM
  4. [SOLVED] Open Multiple Workbooks, Record names, Copy paste to Active Workbook, Close the Workbooks
    By vba_madness in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2013, 06:09 AM
  5. How to Copy Data from multiple workbooks to single workbook
    By Gautam Garg in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 07-23-2012, 04:17 PM
  6. [SOLVED] Copy from single workbook and past to multiple workbooks
    By Alby22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2012, 04:40 PM
  7. copy a single column from mutiple workbooks into a single workbook
    By Savan87 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2011, 11:27 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