http://stackoverflow.com/questions/5117265/does-vba-have-an-atan2-function
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Function ArcTan2(Y As Double, X As Double) As Double Select Case Y Case Is > 0 ArcTan2 = Atn(X / Y) Case Is < 0 ArcTan2 = Atn(X / Y) + PI * Sgn(X) If X = 0 Then ArcTan2 = ArcTan2 + PI Case Is = 0 ArcTan2 = PI_2 * Sgn(X) End Select End Function |