I am an excel noob trying to make a custom excel function that uses degrees while calculating sin of an angle.
Public Function SIND(number As Double)
Formula = "SIN(RADIANS(number))"
Formula = Replace(Formula, "number", number)
SIND = Evaluate(Formula)
End Function
So far I have this but it doesn't work
Here's a better way:
Public Function SIND(degrees As Double) As Double
Dim Rads As Double
Rads = WorksheetFunction.Radians(degrees)
SIND = Sin(Rads)
End Function
The main problem with your way is that you were mixing string functions to do math calculations, and that's just not the best method.