Returns a Boolean value indicating whether an expression can be evaluated as a number.
IsNumeric(expression) |
The required expression argument is a numeric or string expression.
IsNumeric returns True if the entire expression is recognized as a number; otherwise, it returns False.
If expression contains a string, the string is evaluated whether it can be converted to a number starting from the beginning until the first non-numeric character.
This example uses the IsNumeric function to determine if a variable can be evaluated as a number.
Dim MyVar, MyCheck MyVar = "53" ' Assign value. MyCheck = IsNumeric(MyVar) ' Returns True. Trace MyCheck MyVar = "459.95" ' Assign value. MyCheck = IsNumeric(MyVar) ' Returns True. Trace MyCheck MyVar = "Help" ' Assign value. MyCheck = IsNumeric(MyVar) ' Returns False. Trace MyCheck MyVar = 33 ' Assign value. MyCheck = IsNumeric(MyVar) ' Returns True. Trace MyCheck MyVar = "33 la-la-la" ' Assign value. MyCheck = IsNumeric(MyVar) ' Returns True, because can be evaluated to 33 Trace MyCheck |
See Also |
IsDate Function , IsEmpty Function , IsNull Function , VarType Function |