In VBA, we can easily do trigonometry with the many trig functions from the VBA math functions and Excel worksheet functions. In this article, you will learn about all the trigonometric functions that you can use in VBA to perform trigonometry easily.

In VBA, we can easily use trigonometric functions with the help of the VBA math functions. The VBA math functions and Excel worksheet functions allow us to perform trigonometry easily.

In this article, we are going to go over all of the trig functions you can use in VBA and give examples of how to use each one.

Below is a list of each of the trigonometric functions you can use in VBA. If you want, you can keep scrolling or click on one of the links below to go to a section directly.

- pi in VBA
- Excel Worksheet Function Radians()
- Excel Worksheet Function Degrees()
- VBA Sin() Function
- VBA Cos() Function
- VBA Tan() Function
- Excel Worksheet Function Asin()
- Excel Worksheet Function Acos()
- VBA Atan() Function
- Excel Worksheet Function Atan2()
- Excel Worksheet Function Sinh()
- Excel Worksheet Function Cosh()
- Excel Worksheet Function Tanh()
- Excel Worksheet Function Asinh()
- Excel Worksheet Function Acosh()
- Excel Worksheet Function Atanh()

## How We Can Use Pi in VBA

When doing trigonometry, the most fundamental number is pi.

To get the value of pi in VBA, the easiest way is use the Excel Worksheet Function pi. pi returns the value 3.1415926535897939.

```
Debug.Print WorksheetFunction.Pi
'Output:
3.1415926535897939
```

## How to Convert Degrees to Radians with Radians() Worksheet Function in VBA

When working with angles, it’s important to be able to convert between radians and degrees easily. We can convert degrees to radians using the Excel Radians() worksheet function.

The **Radians()** function multiplies the degrees by pi divides by 180.

Below are some examples of how we can use the **Radians()** function to convert degrees to radians in VBA.

```
Debug.Print WorksheetFunction.Radians(0)
Debug.Print WorksheetFunction.Radians(30)
Debug.Print WorksheetFunction.Radians(60)
Debug.Print WorksheetFunction.Radians(90)
'Output:
0
0.523598775598299
1.0471975511966
1.5707963267949
```

## How to Convert Radians to Degrees with Degrees() Worksheet Function in VBA

When working with angles, it’s important to be able to convert between radians and degrees easily. We can convert radians to degrees using the Excel worksheet function Degrees().

The **Degrees()** function multiplies the radians by 180 and divides by pi.

Below are some examples of how we can use the **Degrees()** function to convert radians to degrees in VBA.

```
Debug.Print WorksheetFunction.Degrees(0)
Debug.Print WorksheetFunction.Degrees(WorksheetFunction.Pi/6)
Debug.Print WorksheetFunction.Degrees(WorksheetFunction.Pi/3)
Debug.Print WorksheetFunction.Degrees(WorksheetFunction.Pi/2)
'Output:
0
30
60
90
```

## How to Find Sine of Number with Sin() Function in VBA

To find the sine of a number, in radians, we use the VBA Sin() function.

The input to the **Sin()** function must be a double. The return value will be a double between -1 and 1.

Below are a few examples of how to use the VBA **Sin()** function to find the sine of a number.

```
Debug.Print Sin(WorksheetFunction.Pi/3)
Debug.Print Sin(0)
Debug.Print Sin(WorksheetFunction.Pi/2)
'Output:
0.8660254037844386
0.0
1.0
```

## How to Find Cosine of Number with Cos() Function in VBA

To find the cosine of a number, in radians, we use the VBA Cos() function.

The input to the **Cos()** function must be a double. The return value will be a double between -1 and 1.

Below are a few examples of how to use the VBA **Cos()** function to find the cosine of a number.

```
Debug.Print Cos(WorksheetFunction.Pi/3)
Debug.Print Cos(0)
Debug.Print Cos(WorksheetFunction.Pi/2)
'Output:
0.5000000000000001
1.0
6.123233995736766e-17
```

## How to Find Tangent of Number with Tan() Function in VBA

To find the tangent of a number, or the sine divided by the cosine of an angle, in radians, we use the VBA Tan() function.

The input to the **Tan()** function must be a double. The return value will be a double between negative infinity and infinity.

Below are a few examples of how to use the VBA **Tan()** function to find the tangent of a number.

```
Debug.Print Tan(WorksheetFunction.Pi/3)
Debug.Print Tan(0)
Debug.Print Tan(WorksheetFunction.Pi/2)
'Output:
1.7320508075688767
0.0
1.633123935319537e+16
```

## How to Find Arcsine of Number with Asin() Worksheet Function in VBA

To find the arcsine of a number, we use the VBA Asin() worksheet function.

The input to the **Asin()** function must be a double between -1 and 1. The return value will be a double between -pi/2 and pi/2 radians.

Below are a few examples of how to use the Excel **Asin()** worksheet function to find the arcsine of a number.

```
Debug.Print WorksheetFunction.Asin(0.5)
Debug.Print WorksheetFunction.Asin(0)
Debug.Print WorksheetFunction.Asin(-0.75)
'Output:
0.5235987755982989
0.0
-0.848062078981481
```

## How to Find Arccosine of Number with Acos() Worksheet Function in VBA

To find the arccosine of a number, we use the Excel Acos() worksheet function.

The input to the **Acos()** function must be a double between -1 and 1. The return value will be a double between 0 and pi radians.

Below are a few examples of how to use the Excel **Acos()** worksheet function to find the arccosine of a number.

```
Debug.Print WorksheetFunction.Acos(0.5)
Debug.Print WorksheetFunction.Acos(0)
Debug.Print WorksheetFunction.Acos(-0.75)
'Output:
1.0471975511965979
1.5707963267948966
2.4188584057763776
```

## How to Find Arctangent of Number with Atn() Function in VBA

To find the arctangent of a number, we use the VBA Atn() function.

The input to the **Atn()** function must be a double. The return value will be a double between -pi/2 and pi/2 radians.

Below are a few examples of how to use the VBA **Atn()** function to find the arctangent of a number.

```
Debug.Print Atn(5)
Debug.Print Atn(0)
Debug.Print Atn(-3)
'Output:
1.373400766945016
0.0
-1.2490457723982544
```

## How to Find Arctangent of the Quotient of Two Numbers with Atan2() Worksheet Function in VBA

VBA gives us the ability to find the arctangent of the quotient of two numbers, where the two numbers represents the coordinates of a point (x,y). To find the arctangent of a the quotient of two numbers, we use the VBA Atan2() worksheet function.

The inputs to the **Atan2()** function must be a doubles. The return value will be a double between -pi and pi radians.

Below are a few examples of how to use the VBA **Atan2()** worksheet function to find the arctangent of the quotient of two numbers.

```
Debug.Print WorksheetFunction.Atan2(5,1)
Debug.Print WorksheetFunction.Atan2(0,0)
Debug.Print WorksheetFunction.Atan2(-3,7)
'Output:
1.373400766945016
0.0
-0.40489178628508343
```

## How to Find Hyperbolic Sine of Number with Sinh() Worksheet Function in VBA

To find the hyperbolic sine of a number, we can use the VBA Sinh() worksheet function.

The input to the **Sinh()** function must be a double. The return value will be a double.

Below are a few examples of how to use the VBA **Sinh()** worksheet function to find the hyperbolic sine of a number.

```
Debug.Print WorksheetFunction.Sinh(100)
Debug.Print WorksheetFunction.Sinh(0)
Debug.Print WorksheetFunction.Sinh(-50)
'Output:
1.3440585709080678e+43
0.0
-2.592352764293536e+21
```

## How to Find Hyperbolic Cosine of Number with Cosh() Worksheet Function in VBA

To find the hyperbolic cosine of a number, we can use the VBA Cosh() worksheet function.

The input to the **Cosh()** worksheet function must be a double. The return value will be a double greater than or equal to 1.

Below are a few examples of how to use the VBA **Cosh()** worksheet function to find the hyperbolic cosine of a number.

```
Debug.Print WorksheetFunction.Cosh(100)
Debug.Print WorksheetFunction.Cosh(0)
Debug.Print WorksheetFunction.Cosh(-50)
'Output:
1.3440585709080678e+43
1.0
2.592352764293536e+21
```

## How to Find Hyperbolic Tangent of Number with Tanh() Worksheet Function in VBA

To find the hyperbolic tangent of a number, we can use the VBA tanh() worksheet function.

The input to the **Tanh()** worksheet function must be a double. The return value will be a double between -1 and 1.

Below are a few examples of how to use the VBA **Tanh()** worksheet function to find the hyperbolic tangent of a number.

```
Debug.Print WorksheetFunction.Tanh(20)
Debug.Print WorksheetFunction.Tanh(0)
Debug.Print WorksheetFunction.Tanh(-10)
'Output:
1.0
0.0
-0.9999999958776927
```

## How to Find Hyperbolic Arcsine of Number with Asinh() Worksheet Function in VBA

To find the hyperbolic arcsine of a number, we can use the VBA Asinh() worksheet function.

The input to the **Asinh()** worksheet function must be a double. The return value will be a double.

Below are a few examples of how to use the Excel **Asinh()** worksheet function to find the hyperbolic arcsine of a number.

```
Debug.Print WorksheetFunction.Asinh(10)
Debug.Print WorksheetFunction.Asinh(0)
Debug.Print WorksheetFunction.Asinh(-5.32)
'Output:
2.99822295029797
0.0
-2.3733388650599814
```

## How to Find Hyperbolic Arccosine of Number with Acosh() Worksheet Function in VBA

To find the hyperbolic arccosine of a number, we can use the VBA Acosh() worksheet function.

The input to the **Acosh()** worksheet function must be a double greater than or equal to 1. The return value will be a double.

Below are a few examples of how to use the Excel **Acosh()** worksheet function to find the hyperbolic arccosine of a number.

```
Debug.Print WorksheetFunction.Acosh(5.23)
Debug.Print WorksheetFunction.Acosh(1.2)
Debug.Print WorksheetFunction.Acosh(100)
'Output:
2.3382907483329896
0.6223625037147786
5.298292365610484
```

## How to Find Hyperbolic Arctangent of Number with Atanh() Function in VBA

To find the hyperbolic arctangent of a number, we can use the VBA Atanh() worksheet function.

The input to the **Atanh()** worksheet function must be a double between -1 and 1. The return value will be a double.

Below are a few examples of how to use the VBA **Atanh()** worksheet function to find the hyperbolic arctangent of a number.

```
Debug.Print WorksheetFunction.Atanh(0.5)
Debug.Print WorksheetFunction.Atanh(0)
Debug.Print WorksheetFunction.Atanh(-0.75)
'Output:
0.5493061443340549
0.0
-0.9729550745276566
```

Hopefully this article has been useful for you to learn how to use the trig functions in VBA for trigonometry.