ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pass named range to user defined function returns #value! (https://www.excelbanter.com/excel-programming/400904-re-pass-named-range-user-defined-function-returns-value.html)

Bob Phillips

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.





All times are GMT +1. The time now is 05:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com