See Also Example
Returns the sine of an angle.
Syntax
Sin(angle)
Remarks
The argument angle can be any valid numeric expression
The Sin function takes an angle and returns the ratio of two sides of a right triangle. The ratio is the length of the side opposite the angle divided by the length of the hypotenuse.
The result lies in the range -1 to 1.
To convert degrees to radians, multiply degrees by Pi/180. To convert radians to degrees, multiply radians by 180/Pi. Pi is approximately 3.141593.
Atn Function
Cos Function
Tan Function
Math Functions
Derived Math Functions
The example uses Sin to calculate the sine of an angle with a user-specified number of degrees. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Dim Degrees, Msg, Pi, Radians ' Declare variables.
Pi = 4 * Atn(1) ' Calculate Pi.
Degrees = InputBox("Enter an angle in degrees.") ' Get user input.
Radians = Degrees * (Pi / 180) ' Convert to radians.
Msg = "The sine of a " & Degrees
Msg = Msg & " degree angle is "
Msg = Msg & Sin(Radians) & "."
MsgBox Msg ' Display results.
End Sub