Home ➜ VBA ➜ Top VBA Functions ➜ **VBA SQR Function (Syntax + Example)**

The VBA SQR function is listed under the math category of VBA functions. When you use it in a VBA code, **it returns the square root of the number supplied**. In simple words, you can calculate the square root of a number with it.

## Syntax

**Sqr(Number)**

## Arguments

**Number**: A number for which you want to calculate the square root.

## Example

To practically understand how to use VBA SQR function, you need to go through the below example where we have written a vba code by using it:

```
Sub example_SQR()
Range("B1").Value = Sqr(Range("A1"))
End Sub
```

In the above code, we have used the SQR to get the square root of the value that we have in the cell A1 (625) it has returned the 25 which is the square root of 625 in the cell B1.

How to Calculate SQUARE ROOT in Excel

## Notes

- If the value specified is a value other than a number or a number that can’t be recognized as a number, VBA will return the run-time 13 error.
- If the number supplied is a negative number then VBA will return a run-time 5 error.

## Related Functions

ABS | ATN | COS | EXP | FIX | INT | LOG | RND | ROUND | SGN | SIN | TAN