View Single Post
  #3   Report Post  
Bob Phillips
 
Posts: n/a
Default

Just a thought. Using an error like #N/A is not good user interfacing IMO.
Far better to give a meanigful message (yeah, I know Excel does, but that is
a throwback from years ago).

Using Dave's UDF as an example

Option Explicit

Function myFunc(myVal As Variant) As Variant

If IsNumeric(myVal) Then
myFunc = myVal * 2
Else
myFunc = "#Value must be numeric"
End If

End Function


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"DMc2005" wrote in message
...
Hi

How can i get a user defined function to return an error code like #n/a.

many thank

d