To find the hyperbolic tangent of a number in VBA, we can use the Excel **Tanh()** worksheet function.

`WorksheetFunction.Tanh(x)`

In VBA, we can easily use trigonometric functions from the collection of VBA math functions. These VBA math functions allow us to perform trigonometry easily.

Unfortunately, there is not a function in VBA to calculate the hyperbolic arctangent of a number.

To find the hyperbolic tangent of a number, we can use the Excel worksheet function **Tanh()**.

Below is the VBA syntax to find the hyperbolic tangent of a number.

`WorksheetFunction.Tanh(x)`

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

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

## Finding the Inverse Hyperbolic Tangent of a Number in VBA

With Excel and VBA, we can also find the inverses of the common trigonometric functions. The Atanh() worksheet function allows us to find the inverse of the hyperbolic tangent of a number.

Below, we show that if we pass a number to worksheet function **Tanh()** and then call the **Atanh()** worksheet function, we get back the same number.

```
Debug.Print WWorksheetFunction.Atanh(orksheetFunction.Tanh(10))
'Output:
10.0
```

Hopefully, this article has been beneficial for you to understand how to use the Excel **Tanh()** worksheet function in VBA to find the hyperbolic tangent of a number.

## Leave a Reply