Sqr 函数Sqr function

返回指定一个数的平方根的 DoubleReturns a Double specifying the square root of a number.

语法Syntax

Sqr(数字)Sqr(number)

必需的_number_ 参数Double或任何大于或等于零的有效数值表达式The required number argument is a Double or any valid numeric expression greater than or equal to zero.

示例Example

此示例使用“Sqr”**** 函数计算一个数的平方根。This example uses the Sqr function to calculate the square root of a number.

Dim MySqr
MySqr = Sqr(4)    ' Returns 2.
MySqr = Sqr(23)    ' Returns 4.79583152331272.
MySqr = Sqr(0)    ' Returns 0.
MySqr = Sqr(-4)    ' Generates a run-time error.

另请参阅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.