Returning Error from Functions

L

LeninVMS

I want to return "#N/A" and "#DIV/0" errors from a user define
function. Can someone help?

Thanks
Leni
 
C

Chip Pearson

Lenin,

Declare the function to return a Variant data type, and use CVErr
to create an error value. For example

Function Test() As Variant
Test = CVErr(xlErrDiv0)
' or
Test = CVErr(xlErrNA)
End Function


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
T

Tom Ogilvy

cvErr(xlErrNA)

cvErr(xlErrDiv0)


? cvErr(xlErrNA)
Error 2042
? cvErr(xlErrDiv0)
Error 2007
 
Top