View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Pass named range to user defined function returns #value!

Are you sure =qty*price gives you what you expect. In my system it just
multiplies the first items of each range, that is A1*B1, which cannot be
what you expect.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"IneedHelp" wrote in message
...
If I pass a named range as a parameter to a user defined function, it
returns
#value!

I created several named ranges.
For Example
A1:A100 is qty
B1:B100 is price

If I enter qty * price in colum C, the results are as I expect. However,
when I attemp to pass the named range to a user defined function, it
returns
#value! and debug.print inside by UDF yields no value.

For example: MyFunction(qtyIn, priceIn) returns #Value!

Public Function MyFunction(qtyIn, priceIn)
debug.print qtyIn

MyFunction = qytIn * priceIN
End function

I have experience using VBA but am new to using VBA in Excel.