IsNumeric 函数IsNumeric function

返回指示表达式是否可评估为数值的“Boolean”**** 值。Returns a Boolean value indicating whether an expression can be evaluated as a number.

语法Syntax

IsNumeric(表达式)IsNumeric(expression)

必需的_expression_ 参数是一个包含数值表达式字符串表达式VariantThe required expression argument is a Variant containing a numeric expression or a string expression.

备注Remarks

如果整个_表达式_ 被识别为数字,则“IsNumeric”**** 返回“True”****,否则,返回“False”****。IsNumeric returns True if the entire expression is recognized as a number; otherwise, it returns False.

如果_表达式_ 是数据表达式,则“IsNumeric”**** 返回“False”****。IsNumeric returns False if expression is a date expression.

示例Example

此示例使用“IsNumeric”**** 函数确定变量是否可评估为数值。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.

MyVar = "459.95"    ' Assign value.
MyCheck = IsNumeric(MyVar)    ' Returns True.

MyVar = "45 Help"    ' Assign value.
MyCheck = IsNumeric(MyVar)    ' Returns False.

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.