Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
customized function
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
customized function
Try this:
Function tg(number) tg = Excel.WorksheetFunction.Cosh(number) + Sin(number) End Function That worked for me. The runtime did not know where to find the Cosh function. Thanks, Chuck ravi wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SOS! how do I write a customized function to do multiple-value lookupin Excel 2007? | Excel Discussion (Misc queries) | |||
SOS! how do I write a customized function to do multiple-value lookupin Excel 2007? | Charts and Charting in Excel | |||
Formula Function INTO Customized Toolbar | Excel Discussion (Misc queries) | |||
Customized Formula | Excel Discussion (Misc queries) | |||
Customized function (in cell) does not refresh value :o( | Excel Discussion (Misc queries) |