IsNumeric function
Returns a Boolean value indicating whether an expression can be evaluated as a number.
Syntax
IsNumeric(expression)
The required expression argument is a Variant containing a numeric expression or a string expression.
Remarks
IsNumeric returns True if the entire expression is recognized as a number; otherwise, it returns False.
IsNumeric returns False if expression is a date expression.
Example
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
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho