See Also Example
Returns the square root of a number.
Syntax
Sqr(number)
Remarks
The argument number can be any valid numeric expression
The return type of Sqr function is Double.
Math Functions
The example uses Sqr to calculate the square root of a user-supplied number. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Dim Msg, Number ' Declare variables.
Msg = "Enter a non-negative number."
Number = InputBox(Msg) ' Get user input.
If Number < 0 Then
Msg = "Cannot determine the square root of a negative number."
Else
Msg = "The square root of " & Number & " is "
Msg = Msg & Sqr(Number) & "."
End If
MsgBox Msg ' Display results.
End Sub