contents.gifindex.gifprev1.gifnext1.gif

IsNumeric

Purpose

Returns a value indicating whether or not a Variant variable can be converted to a numeric data type.

Arguments

IsNumeric( variant )

Notes

The argument variant can be any Variant expression. The IsNumeric function returns True (-1) if the expression can be converted to a number; otherwise, it returns False (0).

Expressions that can 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.

Example

This example evaluates TestVar to determine whether it can be converted to a numeric data type and displays an appropriate message.

TestVar = InputBox$("Please enter a number, letter, or symbol.")

If IsNumeric( TestVar ) Then // Evaluate variable.

MsgBox "TestVar data is numeric." // Message if number.

Else

MsgBox "TestVar data is not numeric." // Message if not.

End If