Accessing a cell in a different file using a function. It doesn't work when the file is closed.

renatoab

New Member
Joined
Jun 14, 2009
Messages
32
I can make a reference to a cell (or a range) in a different file by using its adress, for example, typing in a cell:
='c:\directory\filename.xls'!nameOfTheRange
It doesn't matter if the file is open or not.

But I made a function to reference a range in a different file by its adress and name of the range, like this:
=myFunction(adress,nameOfTheRange)

The function myFunction concatenates the strings to build the complete adress of the range.
If the file (the referenced file with the named range) is open, the function works perfectly, but it doesn't work if the file is closed.

What's the difference? How can I make a reference (in a function) to a closed file?
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,216,105
Messages
6,128,861
Members
449,472
Latest member
ebc9

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top