ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   why does atan2 not work?? (https://www.excelbanter.com/excel-discussion-misc-queries/66963-why-does-atan2-not-work.html)

jaison

why does atan2 not work??
 
i would like to use atan2(x,y) in my program but i get an error: "Sub or
function not defined". i try to use atn but it yeild the wrong result.

Chip Pearson

why does atan2 not work??
 
ATAN2 is not a VBA function -- it is an Excel function.
Therefore, you have to call it via Application.WorksheetFunction.
E.g.,

res = Application.WorksheetFunction.Atan2(x, y)


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"jaison" wrote in message
...
i would like to use atan2(x,y) in my program but i get an error:
"Sub or
function not defined". i try to use atn but it yeild the wrong
result.




Bernard Liengme

why does atan2 not work??
 
Also, do remember computer work with angles in radians not degrees
See Help for functions RADIANS and DEGREES
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"jaison" wrote in message
...
i would like to use atan2(x,y) in my program but i get an error: "Sub or
function not defined". i try to use atn but it yeild the wrong result.





All times are GMT +1. The time now is 09:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com