+ Reply to Thread
Results 1 to 8 of 8

Pull data from closed workbooks

  1. #1
    Registered User
    Join Date
    06-10-2009
    Location
    Sandy Eggo
    MS-Off Ver
    Excel 2010
    Posts
    65

    Pull data from closed workbooks

    What is the best way to copy worksheets from a closed workbook into the current open workbook? I've done a little digging around and found the below code but I don't see where it places the data? Also, I'd like to have an if loop to create new worksheets if needed.

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    06-10-2009
    Location
    Sandy Eggo
    MS-Off Ver
    Excel 2010
    Posts
    65

    Re: Pull data from closed workbooks

    Ok, I've rewrote most of the code but I'm getting a little lost on the best way to loop through multiple workbooks and worksheets. To make it a little simpler, I would only need to pull data from one worksheet from multiple workbooks.

    Please Login or Register  to view this content.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Pull data from closed workbooks

    Do you want to loop through all the Excel files in the folder FileLocation points to and copy the data from Sheet1 in each?

    Where in the destination workbook do you want to put the data?
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    06-10-2009
    Location
    Sandy Eggo
    MS-Off Ver
    Excel 2010
    Posts
    65

    Re: Pull data from closed workbooks

    Quote Originally Posted by Norie View Post
    Do you want to loop through all the Excel files in the folder FileLocation points to and copy the data from Sheet1 in each?

    Where in the destination workbook do you want to put the data?
    Yes, I would like to loop through all the Excel files in the FileLocation folder and copy the data from a defined sheet into a new named sheet in the destination workbook at the end of any existing sheets.

    However, the way I have this envisioned is that the user would select a new worksheet in each workbook to pull information from and overwrite any existing worksheets. It might be easy to name the new destination worksheet as the name of the origination workbook.

    I hope that makes sense.

  5. #5
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: Pull data from closed workbooks

    I've found the following helpful for reading values from a closed workbook. HTH

    http://spreadsheetpage.com/index.php...a_closed_file/
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  6. #6
    Registered User
    Join Date
    06-10-2009
    Location
    Sandy Eggo
    MS-Off Ver
    Excel 2010
    Posts
    65

    Re: Pull data from closed workbooks

    Quote Originally Posted by mc84excel View Post
    I've found the following helpful for reading values from a closed workbook. HTH

    http://spreadsheetpage.com/index.php...a_closed_file/
    I've looked over that page already (see first post for code) and didn't understand how and where it was placing the information into the existing workbook.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Pull data from closed workbooks

    Sorry, it's still not clear what you want to do, especially the second part.

    Looping through each workbook and copy the data from, or copying the sheet itself, a specific, named worksheet would be relatively straightforward.

    However looping through and having the user select which sheet to copy from would be more complicated.

    For one thing a method to allow the user to select the required sheet would have to be devised.

  8. #8
    Registered User
    Join Date
    06-10-2009
    Location
    Sandy Eggo
    MS-Off Ver
    Excel 2010
    Posts
    65

    Re: Pull data from closed workbooks

    I already have the method for a user to select a specific sheet in the workbooks using vlookups and a selection box.

    Given that looping through each workbook and copying data from is relatively straightforward, how far off am I with the code in the second post, or should I just use something that is already created?

    Thanks again for all the excellent help here!

+ 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. Pull the data from different closed workbooks paste into master vba
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-12-2015, 06:36 PM
  2. [SOLVED] VBA to pull data from multiple closed workbooks
    By keith740 in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 07-01-2015, 08:30 PM
  3. Replies: 1
    Last Post: 09-06-2005, 12:05 PM
  4. Data from closed workbooks (pull func, indirect.ext, etc ....)
    By Ron de Bruin in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 07:05 AM
  5. [SOLVED] Data from closed workbooks (pull func, indirect.ext, etc ....)
    By Ron de Bruin in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 04:05 AM
  6. Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  7. Replies: 0
    Last Post: 09-05-2005, 10: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