Acos in WorksheetFunction

P

Philosophaie

Program:

Pi=Application.WorksheetFunction.Pi
If z/m=Pi/2 or z/m=3*P/2 Then
Msgbox("N/A")
Else
n = Function.WorksheetFunction.Acos(z/m)
End If

Error code:

Run-time Error '1004':
Unable to get the Acos property of the WorksheetFunction.
 
D

Dana DeLouis

Hi.

n = WorksheetFunction.Acos(z/m)
If z/m=Pi/2 or z/m=3*P/2 Then
Msgbox("N/A")
Else... whatever...

Note that for a Real solution, z/m should be in the Range -1 to +1.
So numbers near Pi/2 and 3 Pi/2 would return complex numbers.
= = = = = = =
Dana DeLouis
 
R

Rick Rothstein

Try it without the "Function." part...

n = WorksheetFunction.Acos(z/m)

You also do not need to specify the Application object in your first line...

Pi = WorksheetFunction.Pi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top