# VBA ATN Function

HomeVBA Functions LIST (Category Wise)How to use the VBA ATN Function (Syntax + Example)

## What is VBA ATN Function

The VBA ATN function is listed under the math category of VBA functions. When you use it in a VBA code, it returns arctangent of a number that you supplied. In simple words, arctangent is used to calculate the angles of a right triangle and ATN returns it for the number you specified.

## how to use it

To use VBA's ATN function you need to understand its syntax and arguments:

Atn(Number)

### Arguments

• Number: The number which you for which you want to calculate the arctangent.

## Example to use ATN Function in VBA

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

```Sub example_ATN()
Range("B1").Value = Atn(Range("A1"))
End Sub```

In the above example, we have used the value from the cell A1 where we have a number for which we want to calculate the arctangent and then we have used the ATN to convert that value into an absolute number and enter that value in the cell B1.

## Notes

Below are some important points which you need to take care while using ATN function in VBA.

• If the value specified is a value other than a number or a number which can’t be recognized as a number, VBA will return the run-time 13 error.
• You can multiply the result returned by the ATN with pi/180 to convert into a radians and 180/pi to convert it into degrees.