See Also Example
Returns a value indicating whether or not a Variant
Syntax
IsNumeric(variant)
Remarks
The argument variant can be any Variant expression. The IsNumeric function returns True if the expression can legally be converted to a number; otherwise, it returns False. Expressions that can legally be converted to a numeric data type include Variant variables of VarType 0 (Empty ), of any numeric value (VarType 2-6), of VarType 7 (Date), and of VarType 8 (String) if the String can be interpreted as numeric.
IsDate Function
IsEmpty Function
IsNull Function
VarType Function
The example evaluates TestVar to determine whether it can legally be converted to a numeric data type and displays an appropriate message. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Dim TestVar ' Declare variable.
TestVar = InputBox("Please enter a number, letter, or symbol.")
If IsNumeric(TestVar) Then ' Evaluate variable.
MsgBox "Entered data is numeric." ' Message if number.
Else
MsgBox "Entered data is not numeric." ' Message if not.
End If
End Sub