# How to use the VBA TAN Function (Syntax + Example)

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

The VBA TAN function is listed under the math category of VBA functions. When you use it in a VBA code, it calculates the tangent of a supplied angle. You can learn more about tangent from here. You just need to specify the angel and it will calculate the tangent.

Table of Content

Tan(Number)

## Arguments

• Number: The number to specify the angel for which you want to get the tangent.

## Example

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

``````Sub example_TAN()
Range("B1").Value = Tan(Range("A1"))
End Sub``````

In the above code, we have used the TAN to get the tangent of the angle which we have in the cell A1 (1.46) and it has returned 8.726459 in the result.

## Notes

• You can multiply the result returned by the TAN with pi/180 to convert it into a radian and 180/pi to convert it into degrees.
• 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.

## Related Functions

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