Excel VBA IsNumeric Function
VBA IsNumeric Function: The IsNumeric function in VBA returns a Boolean value showing whether the specified Expression contains a numeric value or not.
Syntax
IsNumeric (Expression)
Parameter
Expression (required)- This parameter represents the variant that you want to check for numeric.
Return
This function returns a Boolean value True if the given expression contains a numeric value else it returns False.
Example 1
Sub IsNumeric_Example1() Dim var Dim is_Num As Boolean var = 8 is_Num = IsNumeric(var) ' The variable is_Num will return True. MsgBox (is_Num) End Sub
Output
True
Example 2
Sub IsNumeric_Example2() Dim var Dim is_Num As Boolean var = 10 Set var = Nothing is_Num = IsNumeric(var) ' The variable is_Num will return False. MsgBox (is_Num) End Sub
Output