First, you can't refer to a cell in a different file if that sending file is
closed and use =indirect().
Second, the stuff ("'x:\folder\folder\") inside the =indirect() function is a
string. This would always point at the X:\folder\folder location.
I tried this in a test workbook (book1.xls).
I created a new workbook and put "Root" in A1 of sheet1.
Then I saved this workbook as C:\book2.xls
Then I changed A1 to Excel and saved a copy in C:\excel
Then in A1 of Book1.xls, I added this formula.
=INDIRECT("[book2.xls]Sheet1!$A$1")
It returned Excel (since that version of book2.xls was open).
I closed c:\excel\book2.xls and recalculated. I got a #REF! error
(recalculating is important).
Then I opened c:\book2.xls and saw that Root was returned.
So you could drop all the drive/path info from your formulas as long as you
explain that the user MUST open the correct file first.
If they open a file with the same name, but from a different folder, excel will
go happily along. Your users won't get the results they want, but excel won't
care.
==================
On the other hand, if you want to keep the sending workbook closed, you can't
use =indirect() in your function call.
That means you'll have to either tell them to create the formula themselves (or
provide a macro that does the work for them).
Or you could use a function called =indirect.ext() written by Laurent Longre.
(Everyone will have to have a copy of this function/addin, too.)
You can find it in the morefunc.xll addin:
http://xcell05.free.fr/
or
http://xcell05.free.fr/morefunc/english/index.htm
(I didn't test this, so you'll have to watch out for typos.)
=INDIRECT.ext("'" & $a$1 & $b$1 & $C$1 & "\[filename.xls]Sheet1'!A1")
Where
A1 holds the drive (either X: or the UNC share--\\something\otherthing)
B1 holds the folder (\folder\folder)
C1 holds the input (whatever that is)
Dave, That doesn't accomplish my goal. I can't enter a reference to an
external cell without either the path, or another workbook open (A, in this
case). But if I open workbook A first, then set up the formulae, even without
specifying the path it eventually hard codes to that particular A, no matter
what order I close or save things in. I need it to go to whatever version of
that workbook A is open.
Here's what I'm trying to do: A and B both summarize the same information,
just differently. A is generated by another program, B is our standard
in-house summary. Information in B is organized so as to match input required
by another department; A is not. Output of the other program is organized so
that every project has its own folder, and each folder has workbook A in it
(all named identically), but with data for that project. Path to every A is
identical except for the project number, including file name. I need to set
up B so that it will pull numbers from the A file in the path specified by
the user's input of project number.
Did I explain that well enough? And if so, how do I accomplish it, other
than use the one method I've found so far that works and make sure all users
have the same drive letter mapped to the source share?
Thanks again....
:
If workbook A (the sending workbook, right?) is open then you don't need the
path (UNC or mapped drive).
And if the sending workbook is closed, then the =indirect() won't work anyway.
Lynn wrote:
Excel 2003 SP3. ARRRGGGHHHH! I need to sum multiple cells in workbook A into
one cell in workbook B, where part of path to workbook A is a variable input
by the user. If I use
=INDIRECT("'x:\folder\folder\"&input&"\[filename.xls]worksheet_name'!cell")+INDIRECT(same
thing, different cell), all is well. If I change x: to the UNC path
(\\server\sharename, and I know I have the right server and share names) I
get #REF! error. Workbook A is already open in the same instance of Excel.
To make it even more frustrating, if I copy the cell that doesn't work, then
edit the copy changing x: to \\server\share, and hard code in the variable
instead of concatenating, it works again.
From reading other posts, this should work. What am I missing?