Mackeral
Board Regular
- Joined
- Mar 7, 2015
- Messages
- 232
- Office Version
- 365
- Platform
- Windows
My old memory remembers one, but I don't remember it's name.
Here is the one I wrote but it's not nearly as concise as a function call:
Here is the one I wrote but it's not nearly as concise as a function call:
VBA Code:
Function Value_(Arg)
' Returns the Value of the string "Arg"
Prog = "Value_"
If Left(Arg, 1) <> "(" Then
TEMP = Arg
GoSub Error_Check
Value_x = Val(Arg)
ElseIf Right(Arg, 1) = ")" Then
TEMP = Mid(Left(Arg, Len(Arg)), 2)
GoSub Error_Check
Value_ = -Val(TEMP)
Else
Msg1 = "Unmatched Parenthesis in"
Call Msg_Err(Prog, Msg1, Quote(Arg))
Stop
End If
Exit Function
' = = = = = = = = = = = = = = = = = = =
Error_Check:
If Not IsNumeric(Arg) Then
Msg1 = """Arg"" is not a valid number:"
Call Msg_Err(Prog, Msg1, Quote(Arg))
Exit Function
End If
Return
End Function ' Value_x