LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default Error values generated in functions

I need to create a function in VBA Excel.
The code is like this
Function mysub(x as variant) as variant
..................... code goes here ...............
end function
Now if the user enters code mysub(somestring)
or something like that then there is a error message in the Excel Cell
But, I want to get the excel cell not to display such error.
I tried to get the type but it didn't work fine
My code goes like this.

Function newfun(agrus As Variant) As Variant
Dim x As Variant
newfun = argus * agrus
Exit Function
'If IsMissing(argus) Then
'newfun = argus & "No argument in the function"
'Else
x = TypeName(argus)
Select Case x
Case "Range"
newfun = argus & "Cannot take range as argument. Enter Single
cell value"
Case "Null"
newfun = argus & "You didn't entered an argument. Must have
one argument."
Case "Error"
newfun = argus & "You entered a error value. Check the value."
Case "Boolean"
newfun = argus & "You entered boolean value."
Case "Empty"
newfun = argus & "Empty value."
Case Else
newfun = argus & "Other data types. " & TypeName(argus)
End Select
'End If

'newfun = argus & "No you can make a start"
'End If
End Function

Can anyone help

 
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
Obtaining the minimum of values which have been generated by a for Caithness Girl New Users to Excel 6 November 18th 09 05:01 PM
OnError - what generated the error? Robeyx via OfficeKB.com Excel Programming 6 August 11th 08 11:48 AM
Sorting values generated by a formula... Randy L Excel Discussion (Misc queries) 1 August 17th 07 04:00 PM
How do I use ISERROR in functions to hide error values Daz Excel Worksheet Functions 4 June 6th 06 07:30 AM
accumulating values generated daily Tracey Excel Worksheet Functions 1 April 15th 06 08:07 AM


All times are GMT +1. The time now is 11:56 PM.

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

About Us

"It's about Microsoft Excel"