View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default 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