View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Getting #VALUE! while entering UDF as an array function

On Thu, 7 Feb 2008 11:08:53 -0800 (PST), snv wrote:

On Feb 7, 10:45 am, Ron Rosenfeld wrote:
On Thu, 7 Feb 2008 10:28:52 -0800 (PST), snv wrote:
I am trying to enter my own function in an array formula context,
similar to any other pre defined funtion.


Take a look here for some information:

http://www.cpearson.com/excel/return...ysfromvba.aspx

What you need to do is test your argument(s) to see if they are arrays or not;
and if they are, you need to set up an array within your code; and then equate
it to the function name.
--ron


Thanks for the response Ron. A coworker of mine and I just came up
with that same answer.

When I enter the UDF as an array function the entire array is passed
as a single parameter.
When I enter the pre defined excel function as an array function it
behaves as a loop where in invokes the function once for each element
of the array. So the suggested solution works, but can a UDF be
flagged to behave the same as a pre defined function?


Also, in addition to the above reference from Chip Pearson, you should also
familiarize yourself with:

http://www.cpearson.com/Excel/VBAArrays.htm
--ron