View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default function with a range as a parameter

Any function that references a closed workbook (even vlookup) needs to have
the workbook open to get the data. If you need it to work every time, you
probably ought to build a UDF that opens the workbook in question, accesses
the data and then closes the workbook. Of course, every time the workbook is
calculated, all of the external workbooks will need to be opened/closed and
it could take some time.
--
HTH,
Barb Reinhardt



"nox" wrote:

Hi all,

I am trying to write a function that uses a range as a parameter (see below)

Function Param(MyRange As Range, Aline As Integer) As Integer
Param = 5
End Function

The problem is that when the range specifies cells on a closed workbook,
the function dispays an error (#VALUE)
If the range corresponds to an open workbook there is no error.

Is it possible to get back a Range on a closed workbook (like the function
VLOOKUP does) ?
if yes how ?

Thanks

Jim.

(I am using Excel 2000)