Reputation: 429
I am trying to write a short trig function wanting to use sine and cosine functions in VB and I am very new to this as it's my first time coding in VB.
See what I'm trying to accomplish below:
Function XXX(HR, HR_RL, abc)
Const PI As Double = "3.141593"
AC = Sqr(HR ^ 2 + HR_RL ^ 2 - 2 * HR * HR_RL * Cos(abc * PI / 180))
VB is complaining about two things Cos and Sqr.
It seems they are both built-in VBA functions, but somehow I can't get them evaluated and as a result, AC variable = empty.
In fact, it doesn't seem that it even goes past "Cos(abc * PI / 180)". If I substitute "Cos(abc * PI / 180)" with a numeric value (just to see where else is another problem), surely enough, now VB complains about "Sqr".
Upvotes: 0
Views: 1377
Reputation: 8557
Go into your VBA Editor menu and select Tools -> References...
, then check the System
library. It will give you access to all the math functions.
Upvotes: 0