+ Reply to Thread
Results 1 to 5 of 5

Extracting a value from another (non-active) workbook using a path dynamically formed

  1. #1
    Registered User
    Join Date
    09-12-2009
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2002
    Posts
    5

    Question Extracting a value from another (non-active) workbook using a path dynamically formed

    I can’t get Excel 2002 to resolve an external reference to a value in another workbook.

    If I have the following literal expression in a cell in my active worksheet, it works:
    ='C:\Documents and Settings\My Documents\HCS\SAC123.xls'!NumSAC

    In this case, the contents of the variable NumSAC is copied into the active workbook from another workbook named SAC123. This works fine without the SAC123.xls workbook being active.

    But what I really need to do is have Excel reference an expression that I form by concatenating together strings and a cell value (from the active worksheet).

    The following expression evaluates to be exactly the literal expression above (which worked), but it doesn’t act as a valid reference.
    =”'C:\Documents and Settings\My Documents\HCS\" & $B12 & ".xls'!NumSAC"
    The result displayed in that cell is
    'C:\Documents and Settings\My Documents\HCS\SAC123.xls'!NumSAC
    and not what I want.

    If I try to use the INDIRECT function with the above character string, like this,
    =INDIRECT(”'C:\Documents and Settings\My Documents\HCS\" & $B12 & ".xls'!NumSAC")
    then I get
    #REF!

    However, if I open the SAC123 workbook (so that it is in the ring of active workbooks), then I get the correct value put into the cell.

    The INDIRECT function only works if the referenced workbook is active.

    Is there a way of having Excel evaluate a character string as a valid reference without having to have the referenced workbook(s) active?

    In my case, I want to have a master active workbook that references over 200 other workbooks.

    If it helps at all, the master workbook will be in the same file folder as the 200 other workbooks.


    Thanks for any suggestions you may have.
    Last edited by WilliamCRodgers; 09-15-2009 at 05:47 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Extracting a value from another (non-active) workbook using a path dynamically fo

    You can't use INDIRECT with closed workbooks.

    MoreFunc, a popular add-in, has a function INDIRECT.EXT that does.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Extracting a value from another (non-active) workbook using a path dynamically fo

    You would need to add a free addin from here called Morefunc.xll

    http://download.cnet.com/Morefunc/30...-10423159.html

    and then use function INDIRECT.EXT in place of your current INDIRECT
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    09-12-2009
    Location
    Tampa, Florida
    MS-Off Ver
    Excel 2002
    Posts
    5

    Smile Re: Extracting a value from another (non-active) workbook using a path dynamically fo

    I was hoping for a solution within standard Excel since this will be used by someone else. However, I'm grateful to find there is a solution.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Extracting a value from another (non-active) workbook using a path dynamically fo

    Morefunc.xll has a special feature that allows you to embed the addin into the workbook so that you can share the file with others without having them install the addin.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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