Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I get a UDF to return #N/A, as if from =NA()
Function foo(v)
' try v = 0 and v = 1 On Error GoTo errH foo = 1 / v Err.Raise 12345 Exit Function errH: If Err.Number = 11 Then foo = CVErr(xlErrDiv0) ElseIf Err.Number = 12345 Then foo = CVErr(xlErrNA) Else foo = CVErr(xlErrValue) End If End Function here are the XlCVError constants xlErrDiv0 xlErrNA xlErrName xlErrNull xlErrNum xlErrRef xlErrValue Regards, Peter T "Barb Reinhardt" wrote in message ... I have a user defined function and at times I want it to return =NA() in the cell. How do I do this? I can get it to return a text string, but not a formula. Thanks, Barb Reinhardt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Return date if in range, else return blank | Excel Worksheet Functions | |||
Compare Value in Cell 1 to a List, Return Value if Match otherwise Return Null | Excel Discussion (Misc queries) | |||
LOOKUP and return the column heading for IF/THEN return for False | Excel Discussion (Misc queries) | |||
check if reference exists, then return its value or return 0 | Excel Worksheet Functions | |||
VBA Syntax for VLOOKUP to return array of return values | Excel Programming |