+ Reply to Thread
Results 1 to 7 of 7

Error when extracting information from multiple workbooks

  1. #1
    Registered User
    Join Date
    07-07-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    9

    Error when extracting information from multiple workbooks

    Hello,

    I'm using a macro which extracts information from specific cells across all the workbooks in a specified location. It then outputs this information into a separate spreadsheet row by row for each spreadsheet.

    The problem I have is that only extracts the information from workbooks that I have opened. If for example I copy a workbook across and don't open it then run the macro it won't extract the information from that workbook (any workbooks I have previously opened will work fine), it just gives me #NAME or #REF errors in the cells it should be placing the information.

    Is it something to do with the security on a file ? I am a little perplexed.

    The macro I am using is below

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Error when extracting information from multiple workbooks

    This should do it, it will leave open any files that were already open, it will open and close the rest as needed. We're also transferring the values more directly.

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    07-07-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    9

    Re: Error when extracting information from multiple workbooks

    I've tried the code and it only extracts the information from the first spreadsheet in the directory. After this it stops running irrelevant of how many other files are in the directory.

  4. #4
    Registered User
    Join Date
    07-07-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    9

    Re: Error when extracting information from multiple workbooks

    I've just tried debugging the code and when you step into the code and take it line by line, it is cycling through each file correctly as I can see the variable being changed. However the output is still always only the first spreadsheet despite it stepping through each file correctly.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Error when extracting information from multiple workbooks

    Take out the On Error Resume Next line and step through it again, see if it fails. Debug and examine which line has failed.

    Maybe you have an extra \ in there somewhere.

  6. #6
    Registered User
    Join Date
    07-07-2014
    Location
    UK
    MS-Off Ver
    2010
    Posts
    9

    Re: Error when extracting information from multiple workbooks

    It fails on

    Please Login or Register  to view this content.
    although I'm not sure why.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Error when extracting information from multiple workbooks

    When you hover your mouse over the "fn" what is the current value?
    When you hover your mouse over "MyDir" what is the current value?

+ 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] Extracting information from multiple tables (Vlookup, Index match, indirect??)
    By vesper007 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-07-2016, 02:36 AM
  2. [SOLVED] Extracting information from multiple excel files
    By excelactuary in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-14-2014, 08:39 AM
  3. Replies: 0
    Last Post: 07-29-2013, 03:00 AM
  4. Inputing multiple text files and extracting information.
    By Winkler1 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-13-2012, 02:28 PM
  5. Extracting multiple information
    By joanne267 in forum Excel General
    Replies: 4
    Last Post: 04-24-2009, 08:04 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