Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default UDF Returning #N/A

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default UDF Returning #N/A

On Fri, 21 Oct 2005 18:41:02 -0700, KAHAUS
wrote:

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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default UDF Returning #N/A

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




KAHAUS wrote:

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


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default UDF Returning #N/A

Both Ron & Dave: Thanks, works great! Ive been searching for CVErr for days!

"Dave Peterson" wrote:

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




KAHAUS wrote:

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


--

Dave Peterson

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
Returning a zero Dena Excel Discussion (Misc queries) 4 February 10th 09 05:04 PM
UDF returning #VALUE! why? Adam Kroger Excel Discussion (Misc queries) 7 December 18th 05 09:43 PM
=if returning 0 Jim Excel Worksheet Functions 4 December 15th 05 07:09 PM
Returning a 0 Value Steved Excel Worksheet Functions 3 July 29th 05 02:44 AM
If/Then help in returning value Big Chris[_34_] Excel Programming 3 February 22nd 04 09:28 PM


All times are GMT +1. The time now is 02:57 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"