TOP

VBA Function: Sqr

YouLibreCalc for Excel logo

Description

The VBA Sqr function returns the square root of a number.


Sqr Syntax

Sqr(number)

VBA Sqr Example

Using the Round function to calculate the square root of a number.

Sub SqrExample()

      MySqr = Sqr(4)  'Returns: 2
      MySqr = Sqr(23) 'Returns: 4.79583152331272
      MySqr = Sqr(0)  'Returns: 0
      MySqr = Sqr(-4) 'Returns an error when executing the code
    
end sub