A
Amedee Van Gasse
I inherited a behemoth of an Excel file (Excel 2003) that was created
by multiple people in different countries, who may or may not have
left the company. Anyway, I'm on my own.
In one of the sheets, I find the following functions:
Cell U1:
='Site General'!U1
Cell U2:
="["&INDIRECT("u$1")&"]Recurrent (Summary by Unit)"&""
Cell U4 and below:
=IF(ISERROR(INDIRECT(ADDRESS($L4;4;;1;U$2)));0;INDIRECT(ADDRESS
($L4;4;;1;U$2)))
($L4 becomes $L5, $L6,...)
The result of these functions is:
Cell U1:
V5 Spain.XLS
--> this is a file that is (or should be) always in the same directory
as the current file.
Cell U2:
[V5 Spain.XLS]Recurrent (Summary by Unit)
Cell U4 when V5 Spain.XLS is not open:
0
Cell U4 when V5 Spain.XLS is also open:
some value from the tab "Recurrent (Summary by Unit)" in the file V5
Spain.XLS
Now I close Excel and reopen the first file, only that file. I do not
open V5 Spain.XLS.
In W11, a blank cell, I put the following function:
=ADDRESS($L11;4;;1;U$2)
The result of that function is the following text string:
'[V5 Spain.XLS]Recurrent (Summary by Unit)'!$D$11
In X11 I put the following function:
=INDIRECT(W11)
The result is #REF!
Then I copy W11 and I Paste Special -> Values into W12.
The value of W12 is now:
'[V5 Spain.XLS]Recurrent (Summary by Unit)'!$D$11
=INDIRECT(W12) is also #REF!
Then I click with the mouse inside W12 and I change it from:
'[V5 Spain.XLS]Recurrent (Summary by Unit)'!$D$11
to:
='[V5 Spain.XLS]Recurrent (Summary by Unit)'!$D$11
Now the result isn't #REF! but 123456.7: the value of cell D11 on
sheet Recurrent (Summary by Unit) in the file V5 Spain.XLS
I have also noticed that without my intervention, the function changed
from:
='[V5 Spain.XLS]Recurrent (Summary by Unit)'!$D$11
to:
='C:\Documents and Settings\username\My Documents\YetAnotherDirectory\
[V5 Spain.XLS]Recurrent (Summary by unit)'!$D$11
so that's the complete path to the file.
The user of this document desires that he gets the data from the other
sheets, without needing to open the sheet. As proven above, this is
not possible with functions. In theory it could be possible with VBA
to construct the hardcoded filenames, but that would be cumbersome
(and slow: hundreds of cells to fill) and it would break the moment
that the files are moved to another directory. I *can* do that, and
have done so in the past, but I'd hate to pass this on to the next
person after me who has to maintain it.
Please advise.
by multiple people in different countries, who may or may not have
left the company. Anyway, I'm on my own.
In one of the sheets, I find the following functions:
Cell U1:
='Site General'!U1
Cell U2:
="["&INDIRECT("u$1")&"]Recurrent (Summary by Unit)"&""
Cell U4 and below:
=IF(ISERROR(INDIRECT(ADDRESS($L4;4;;1;U$2)));0;INDIRECT(ADDRESS
($L4;4;;1;U$2)))
($L4 becomes $L5, $L6,...)
The result of these functions is:
Cell U1:
V5 Spain.XLS
--> this is a file that is (or should be) always in the same directory
as the current file.
Cell U2:
[V5 Spain.XLS]Recurrent (Summary by Unit)
Cell U4 when V5 Spain.XLS is not open:
0
Cell U4 when V5 Spain.XLS is also open:
some value from the tab "Recurrent (Summary by Unit)" in the file V5
Spain.XLS
Now I close Excel and reopen the first file, only that file. I do not
open V5 Spain.XLS.
In W11, a blank cell, I put the following function:
=ADDRESS($L11;4;;1;U$2)
The result of that function is the following text string:
'[V5 Spain.XLS]Recurrent (Summary by Unit)'!$D$11
In X11 I put the following function:
=INDIRECT(W11)
The result is #REF!
Then I copy W11 and I Paste Special -> Values into W12.
The value of W12 is now:
'[V5 Spain.XLS]Recurrent (Summary by Unit)'!$D$11
=INDIRECT(W12) is also #REF!
Then I click with the mouse inside W12 and I change it from:
'[V5 Spain.XLS]Recurrent (Summary by Unit)'!$D$11
to:
='[V5 Spain.XLS]Recurrent (Summary by Unit)'!$D$11
Now the result isn't #REF! but 123456.7: the value of cell D11 on
sheet Recurrent (Summary by Unit) in the file V5 Spain.XLS
I have also noticed that without my intervention, the function changed
from:
='[V5 Spain.XLS]Recurrent (Summary by Unit)'!$D$11
to:
='C:\Documents and Settings\username\My Documents\YetAnotherDirectory\
[V5 Spain.XLS]Recurrent (Summary by unit)'!$D$11
so that's the complete path to the file.
The user of this document desires that he gets the data from the other
sheets, without needing to open the sheet. As proven above, this is
not possible with functions. In theory it could be possible with VBA
to construct the hardcoded filenames, but that would be cumbersome
(and slow: hundreds of cells to fill) and it would break the moment
that the files are moved to another directory. I *can* do that, and
have done so in the past, but I'd hate to pass this on to the next
person after me who has to maintain it.
Please advise.