Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Returning Error from Functions

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

Thanks
Leni

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Returning Error from Functions

cvErr(xlErrNA)

cvErr(xlErrDiv0)


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

--
Regards,
Tom Ogilvy


"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/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Returning Error from Functions

Thanks Chip. It worked.

Regards
Leni

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula returning an error gotroots Excel Worksheet Functions 2 January 4th 10 04:53 PM
VLOOKUP returning a #VALUE! error and I've not idea why! HELP!!! forevertrying Excel Worksheet Functions 18 June 25th 09 03:15 AM
SUMPRODUCT formula returning #VALUE! error Valerie Excel Worksheet Functions 5 April 28th 06 02:36 PM
Custom function returning VALUE error alex.k Excel Discussion (Misc queries) 6 September 27th 05 03:05 AM
Formula returning #N/A Error---why??? Excel User Excel Worksheet Functions 4 September 26th 05 02:25 PM


All times are GMT +1. The time now is 03:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"