View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams Tim Williams is offline
external usenet poster
 
Posts: 1,588
Default UDF returning a 2 dimentional array



"Jim Thomlinson" wrote in message
...
A UDF used within a spreadsheet can only return a value to a single cell.
It
can not put values into cells that it is not in. So how do you intend to
use
this UDF in a spreadsheet... or do you?


Jim,

Can't a UDF could be used as an array formula via ctrl+alt+enter ??

Tim


In code a function can take an array as an input and return an array.
Maybe
I just don't understand what you are trying to do???
--
HTH...

Jim Thomlinson


"Alan" wrote:

I would like to write a user defined function that would return a 2
dimentional array of values based on the value of a supplied
parameter ... can anyone tell me how to do it?

Intuitively, although I know this is wrong, I would like to define a
function something like -

Public Function Arr(2,10)(byval Param as long) as variant

Where (2,10) are the dimensions of the array and Param is the supplied
decision parameter. If the syntax is corrected, can this be done??

As a supplementary, if this can be done can Arr be redimensioned
within the function to return a bespoke array without blank fields or
must he original size of Arr be generic and oversized to cover all
cases?

Regards,

Alan