Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Function ACOS in Excel VBA
Does anybody know if there is an equivalent function in excel VBA like
"ACOS()" in Excel worksheet. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Data Validation/Lookup function does function correcty | Excel Worksheet Functions | |||
Modified ACOS function | Excel Discussion (Misc queries) | |||
Excel - User Defined Function Error: This function takes no argume | Excel Programming | |||
Acos Function | Excel Programming | |||
When I Import an Access Table With an Excel Function in a Cell it Displays as Text not as a Function in Excel | Excel Programming |