Make sure you save the function in a General module--not behind a worksheet, not
behind ThisWorkbook, not in a class module.
And if you're using that UDF in a different workbook (not personal.xls), you'll
need to use something like:
=personal.xls!ROP(a1,b1,c1)
And VBA doesn't have a Sum or Roundup in its arsenal. You could go back and use
excel's builtin functions with something like:
With Application
ROP = .RoundUp(.Sum(Usage / 12 * LeadTime) + (Usage / 12 * SafetyStock), 0)
End With
The dots in front of .roundup and .sum mean that they belong to the object in
the previous With statement--the Excel Application in this case.
Michael Smith wrote:
Hi all, I'm creating my first function, and I think I have it right, but
excel doesn't recognize my function and returns #NAME? Is there a
problem with my code?,.. or is this a referencing problem in VBE. I am
saving this in a module in personal.xlsx
Thanks!
-Mike
Function ROP(Usage, LeadTime, SafetyStock)
ROP = RoundUp(Sum(Usage / 12 * LeadTime) + (Usage / 12 *
SafetyStock), 0)
End Function
*** Sent via Developersdex http://www.developersdex.com ***
--
Dave Peterson