Reference a Macro to perform Cell formula
Hi,
I was wondering if it is possible to actually make a macro that would perform a math function and then have a cell use that macro to come up with the value that is displayed in the cell? Reason being is that I'm pretty sure I can make a macro that would calculate what I need in my previous post "Desperately needing furmula help" but I'm wondering how I would get the cell to use that macro to get the result. Unless someone has a better idea. Thanks Very Much, in Advance, Fred |
Reference a Macro to perform Cell formula
Write the macro as a function. Check VBA help for user defined functions
(UDF) or "writing a function procedure" - under conceptual topics. Function MyFunction(FirstArgument As Double) As Double MyFunction = FirstArgument * 2 End Function In excel, you would call this example with =myfunction(A1) If A1=5, this function will return 10 (the usage is pretty much the same as any other excel function) "Fred "Djinn" Holstings" wrote: Hi, I was wondering if it is possible to actually make a macro that would perform a math function and then have a cell use that macro to come up with the value that is displayed in the cell? Reason being is that I'm pretty sure I can make a macro that would calculate what I need in my previous post "Desperately needing furmula help" but I'm wondering how I would get the cell to use that macro to get the result. Unless someone has a better idea. Thanks Very Much, in Advance, Fred |
All times are GMT +1. The time now is 08:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com