Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default generating a #VALUE

I have a UDF which, if it can't find what it's looking for, I want to return
and show #VALUE in the cell. Any ideas how do I do this? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default generating a #VALUE

Use the CVErr function to create an Error type Variant and return that as
the result of the function.

Function Whatever() As Variant
If Something Then
Whatever = CVErr(xlErrValue)
End If
End Function


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Smallweed" wrote in message
...
I have a UDF which, if it can't find what it's looking for, I want to
return
and show #VALUE in the cell. Any ideas how do I do this? Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default generating a #VALUE

One way might be to trying adding a number and a letter..

Function Test()
Test = 1 + "a"
End Function



--
Hope that helps.

Vergel Adriano


"Smallweed" wrote:

I have a UDF which, if it can't find what it's looking for, I want to return
and show #VALUE in the cell. Any ideas how do I do this? Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default generating a #VALUE

Have your function return a variant

Function myFunc(arg1 as ...) as Variant
'some code here
myFunc = CVErr(xlErrValue)
end function



Smallweed wrote:

I have a UDF which, if it can't find what it's looking for, I want to return
and show #VALUE in the cell. Any ideas how do I do this? Thanks.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default generating a #VALUE

forcing an error in excel will give the results. This worked for me

Function test(target As Range)

test.Value2 = "Error 2015"
End Function

"Smallweed" wrote:

I have a UDF which, if it can't find what it's looking for, I want to return
and show #VALUE in the cell. Any ideas how do I do this? Thanks.

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
Generating a List Rob Excel Programming 1 September 7th 06 05:15 PM
Generating Error for UDF Loomah[_3_] Excel Programming 3 June 23rd 06 08:48 PM
Generating list kong Karl Excel Worksheet Functions 1 June 23rd 06 09:19 AM
Generating Ranges in VBA cmk18[_4_] Excel Programming 0 June 16th 05 08:12 PM
Generating reports Scribe Excel Programming 2 January 30th 04 12:45 PM


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