UDF Using Defined Name
You are wanting to point at a range so you need to include that in your code
something like this... (you should also specify the arguments and return
value of your function)
Public Function FTE(SRnum as Range, RELnum as Range) as double
FTE = ((SRnum.value * range("SRfactor").value) + _
(RELnum.value / 12 * range("RELfactor").value)) / 168
End Function
--
HTH...
Jim Thomlinson
"PatK" wrote:
Can someone please tell me how I can access the contents of a Defined Name in
a user defined function?
I have a page in a workbook with a number of "factors". I have, on a second
worksheet, a series of cells into which I have placed the UDF, with a few
parameters.
In some cases, the same factor is always used in the function, I do not wish
to pass that factor to the function, rather, just point at the defined name.
In the following
Public Function FTE(SRnum, SRfactor, RELnum, RELfactor)
FTE = ((SRnum * SRfactor) + (RELnum / 12 * RELfactor)) / 168
End Function
The factors SRfactor and RELfactor are fixed, and stored in a defined name
on another sheet. Rather than always passing these values, I would like to
simply point at them. I have tried a number of ways I have seen in books on
excel functions, etc, but they always result in a #Value error.
The defined name of these factors, on worksheet "Factors" are SRHours and
RELHours. How would I replace SRfactor and RELfactor to point at these
defined names?
Thanks!!!!
|