Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Customized function
Hello,
I'm trying to write a simple function in VBA and to use it in the worksheet. I do the following steps: 1. Alt+F11 2. Defining the function: Function Koah(duration, percentage As Double) As Double Koah = duration * percentage / 12 End Function 3. Closing VBA But the name of the function doesn't appear in the list of "All" functions, and excel don't recognize my customized function. I tried to write a macro with this function - and it works, the problem that I need to use the function without the macro. Is it something Excel definitions? Please help, |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Customized function
Make sure the function is in a standard module.
User Defined Functions (UDFs) are very easy to install and use: 1. ALT-F11 brings up the VBE window 2. ALT-I ALT-M opens a fresh module 3. paste the stuff in and close the VBE window If you save the workbook, the UDF will be saved with it. To remove the UDF: 1. bring up the VBE window as above 2. clear the code out 3. close the VBE window To use the UDF from Excel: =koah(A1,A2) To learn more about macros in general, see: http://www.mvps.org/dmcritchie/excel/getstarted.htm or http://www.cpearson.com/excel/Writin...ionsInVBA.aspx for specifics on UDFs -- Gary''s Student - gsnu200802 "Elena" wrote: Hello, I'm trying to write a simple function in VBA and to use it in the worksheet. I do the following steps: 1. Alt+F11 2. Defining the function: Function Koah(duration, percentage As Double) As Double Koah = duration * percentage / 12 End Function 3. Closing VBA But the name of the function doesn't appear in the list of "All" functions, and excel don't recognize my customized function. I tried to write a macro with this function - and it works, the problem that I need to use the function without the macro. Is it something Excel definitions? Please help, |
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? | Charts and Charting in Excel | |||
Formula Function INTO Customized Toolbar | Excel Discussion (Misc queries) | |||
Calling customized DLL function fails | Excel Programming | |||
Customized function (in cell) does not refresh value :o( | Excel Discussion (Misc queries) | |||
customized function | Excel Programming |