View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default customized function

cos and sin are legitimate functions in VBA (as well as Excel worksheet
functions - but used as you do, you are using the VBA versions). This is
not true of Cosh, Sinh or Ln. You can use

Worksheetfunction.Cosh, WorksheetFunction.Sinh and WorksheetFunction.Ln.

There is actually a function Log in VBA that is the same as the Excel
Worksheet function Ln. So you could use Log instead of LN.

--
Regards,
Tom Ogilvy

"ravi" wrote in message
...
I am trying to create a customized function.When ever I use cosh or sinh

or
ln .. function within a formula I get a compile error. Sub or function

not
defined.

sample code

Function tg(number)
tg = Cosh(number) + Sin(number)
End Function

I get no error when I use this code but with simple sin and cos

Function tg(number)
tg = Cos(number) + Sin(number)
End function

any ideas why this happens ?

Thanks in advance

ravi