How are you trying to do it?
You should just be able to use VBA Cos like this:
Yeah it works for Cos, but not for these:
These three functions I just can't seem to get to work in VBA.
Are they allowed in VBA, or is it just in Excel?
And if it is just in Excel, is there anyway I can transfer them into VBA?
Direct from the help files. Note the piece at the end on how to calculate Radians.
You can also search for "Derived Math Functions" which will explain how to create your own functions for the ones that do not exist.Cos Function
Returns a Double specifying the cosine of an angle.
The required number argument is a Double or any valid numeric expression that expresses an angle in radians.
The Cos function takes an angle and returns the ratio of two sides of a right triangle. The ratio is the length of the side adjacent to 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.
Or you can also use the Application.Worksheetfunctions object.
The square root function in VBA is SQR(number)
Norie's method is also useful for all other root calculations.
27^(1/3) ' cubed root
There are currently 2 users browsing this thread. (0 members and 2 guests)