Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to create a simple VBA Custom Function
Through Insert | Name | Define, I can create a name (for example MyRatio)
to hold the value 2.53. In VBA, how can I create a function to hold this value? I know nothing about creating Custom VBA Function and is trying to learn from this simple example. Lets give the function the name MyRatio and I need it to hold any value with 2 decimals. Its ok to hardcode the value within the function procedure as I will edit the value in VBA whenver the rate changes. Any help is appreciated. Thanks a lot -- Edmund (Using Excel XP) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to create a simple VBA Custom Function
In your visual basic editor, right click on your project in the project pane and select Insert - Module. Write your function code in this new module. -- C01d ------------------------------------------------------------------------ C01d's Profile: http://www.excelforum.com/member.php...o&userid=34422 View this thread: http://www.excelforum.com/showthread...hreadid=544145 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to create a simple VBA Custom Function
What is the difference if I insert my Function in a Module, class Module and just a spreadsheet (e.g. Sheet1) -- tmingfai ------------------------------------------------------------------------ tmingfai's Profile: http://www.excelforum.com/member.php...o&userid=34221 View this thread: http://www.excelforum.com/showthread...hreadid=544145 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to create a simple VBA Custom Function
tmingfai,
You can not define a Function in a cell or range of a spreadsheet. I think you can define it in a Class Module, but I've never done that. In a nutshell, the difference between a Macro and a Function is that macros perform actions while Functions return a value. Functions don't *do* anything. "tmingfai" wrote: What is the difference if I insert my Function in a Module, class Module and just a spreadsheet (e.g. Sheet1) -- tmingfai ------------------------------------------------------------------------ tmingfai's Profile: http://www.excelforum.com/member.php...o&userid=34221 View this thread: http://www.excelforum.com/showthread...hreadid=544145 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to create a simple VBA Custom Function
If you're intending to call function macros from a spreadsheet, you
should put them in a standard module. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to create a simple VBA Custom Function
:I think
you can define it in a Class Module, but I've never done that. You can't do that. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "cush" wrote in message ... tmingfai, You can not define a Function in a cell or range of a spreadsheet. I think you can define it in a Class Module, but I've never done that. In a nutshell, the difference between a Macro and a Function is that macros perform actions while Functions return a value. Functions don't *do* anything. "tmingfai" wrote: What is the difference if I insert my Function in a Module, class Module and just a spreadsheet (e.g. Sheet1) -- tmingfai ------------------------------------------------------------------------ tmingfai's Profile: http://www.excelforum.com/member.php...o&userid=34221 View this thread: http://www.excelforum.com/showthread...hreadid=544145 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Create a simple input box | Excel Discussion (Misc queries) | |||
Simple problem, simple formula, no FUNCTION ! | Excel Worksheet Functions | |||
Create custom function | Excel Discussion (Misc queries) | |||
Create custom function and add to the | Excel Programming | |||
Trying to create a custom "clear worksheet" function (in a VBA module) | Excel Programming |