The VBA IsNumeric Function

Description

The VBA IsNumeric function returns a Boolean, indicating whether a supplied expression is interpreted as a numeric value.

The syntax of the function is:

IsNumeric( Expression )

Where the supplied Expression is the expression that you want to test


VBA IsNumeric Function Examples

The following example supplies five different expressions to the VBA IsNumeric function.

' Test if five different expressions are numeric.
Dim isNum1 As Boolean
Dim isNum2 As Boolean
Dim isNum3 As Boolean
Dim isNum4 As Boolean
Dim isNum5 As Boolean
isNum1 = IsNumeric( 5 )
' The variable isNum1 is now equal to True.
isNum2 = IsNumeric( "5" )
' The variable isNum2 is now equal to True.
isNum3 = IsNumeric( True )
' The variable isNum3 is now equal to True.
isNum4 = IsNumeric( #1/1/2016# )
' The variable isNum4 is now equal to False.
isNum5 = IsNumeric( "A55" )
' The variable isNum5 is now equal to False.

The above examples show that the isNumeric function returns:

Note that if the supplied Expression is a String containing numbers, the IsNumeric function will only return True if the entire String is numeric.