Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Function ACOS in Excel VBA

Does anybody know if there is an equivalent function in excel VBA like
"ACOS()" in Excel worksheet.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Function ACOS in Excel VBA

I don't see it but you can use the excel function in vba, as in the following
example that I snipped from VBA help:

Sub UseFunction()
Dim myRange As Range
Set myRange = Worksheets("Sheet1").Range("A1:C10")
answer = Application.WorksheetFunction.Min(myRange)
MsgBox answer
End Sub

I think if you change Min to Acos it should work.

You can get a list of excel functions available to VBA by searching VBA help
on "using excel functions".

Hope this helps.

Keith

"mario" wrote:

Does anybody know if there is an equivalent function in excel VBA like
"ACOS()" in Excel worksheet.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Function ACOS in Excel VBA

There's no VB equivalent. You can call Excel's ACOS worksheet function but
it's probably faster to roll your own VB function. Take your pick -

Sub test()
Dim cv As Double, radians As Double
cv = 0.5 ' test with multiple values -1 to +1

radians = fnACOS(cv)
MsgBox Application.WorksheetFunction.acos(cv) & vbCr & _
radians & vbCr & _
cv & vbCr & _
Cos(radians)

End Sub

Function fnACOS(CosVal As Double) As Double
Dim rad As Double
Const pi As Double = 3.14159265358979

If CosVal = 0 Then
' avoid div/0 error
'rad = Atn(1000000000000#)
'or
rad = 1.5707963267949
Else
rad = Atn(Sqr(1 - CosVal ^ 2) / CosVal)
If CosVal < 0 Then
rad = pi + rad
End If
End If

fnACOS = rad

End Function

regards,
Peter T


"mario" wrote in message
...
Does anybody know if there is an equivalent function in excel VBA like
"ACOS()" in Excel worksheet.

Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Function ACOS in Excel VBA

A&A - PRESTAÇÃO DE SERVIÇO.

Melhore suas planilhas!

- Deixe-as mais rápidas
- Torne-as mais funcionais
- Aplique lay-outs mais modernos
- Melhore a apresentação dos seus dados
- impressione os gerentes e a diretoria

Crie o seu M.I.S. personalizado, desenvolva um Dataware, implemente
seu BI.

- Envie dados do seu Banco de Dados
diretamente para a sua aplicação

- Recolha informações diretamente da
Web (Cotações, Taxas, Alíquotas, etc...)

Programação VBA, Reports, Dashboards, Pivot Tables (Tabelas
Dinmicas), Ordenações, Agrupamentos, Interfaces, etc. . .

Entre em contato. Prestamos serviço diretamente pela Internet.

Você envia e implementamos sua solicitação.

Também desenvolvemos aplicações MS Access.

Mail:

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Data Validation/Lookup function does function correcty Kirkey Excel Worksheet Functions 2 May 25th 09 09:22 PM
Modified ACOS function danpt Excel Discussion (Misc queries) 4 November 3rd 08 08:17 AM
Excel - User Defined Function Error: This function takes no argume BruceInCalgary Excel Programming 3 August 23rd 06 08:53 PM
Acos Function No Name Excel Programming 1 June 22nd 04 10:16 PM
When I Import an Access Table With an Excel Function in a Cell it Displays as Text not as a Function in Excel Niek Otten Excel Programming 2 September 18th 03 03:55 AM


All times are GMT +1. The time now is 11:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"