Cos VBA function – How to calculate the cosine

Last Updated on January 11, 2023 by token

Cos VBA function – Description

The Cos VBA function returns the cosine value. You should use this function to calculate the cosine value. For example, the cosine of 0 is equal to 1.

VBA Cos function – Syntax

'officeinside.org
Cos (Number As Double) As Double

Number : The number on witch you want to calculate cosine value.

Function return : Double / numeric value.

VBA Cos function Example

How to use the Cos function in VBA Excel? Below are examples of using the Cos function in the VisualBasic Editor.

Example 1 : An example of using the Cos VBA function – result in the MsgBox window.

'officeinside.org
Dim dblNumber As Double
dblNumber = 0
MsgBox Cos (dblNumber)

Example 2 : VBA Cos – function example – result in an Excel sheet.

'officeinside.org
Dim dblNumber2 As Double
dblNumber2 = 0
Range ("A1") = Cos (dblNumber2)
Excel VBA functions - Cos VBA function
Excel VBA functions – Cos VBA function

VB Cos function – Additional information

  • none

Cos VisualBasic function – Where to use?

The function can be used in: Excel 2003, Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Excel 365.

The article is part of the VBA Excel function list. You can find a list of all VBA functions at this address:  VBA functions .

Leave a comment

Your email address will not be published. Required fields are marked *

%d bloggers like this: