View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Returning Error from Functions

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



"LeninVMS " wrote in
message ...
I want to return "#N/A" and "#DIV/0" errors from a user defined
function. Can someone help?

Thanks
Lenin


---
Message posted from http://www.ExcelForum.com/