UDF Returning #N/A

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

With a user defined function saved in an *.xla add-in...
How can I make the function return the worksheet error value #N/A?

as an example (that doesn't work)

Function MyFunction(x,y, optional z)
MyFunction = application.worksheetfunction.NA()
End Function
 
With a user defined function saved in an *.xla add-in...
How can I make the function return the worksheet error value #N/A?

as an example (that doesn't work)

Function MyFunction(x,y, optional z)
MyFunction = application.worksheetfunction.NA()
End Function

Function foo()
foo = CVErr(xlErrNA)
End Function


--ron
 
something like:

Option Explicit
Function MyFunction(x, y, Optional z) As Variant
If IsMissing(z) Then
MyFunction = CVErr(xlErrNA)
Else
MyFunction = z
End If
End Function
 
Back
Top