Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default 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
  #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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using an offset formula for the reference in a relative reference Cuda Excel Worksheet Functions 6 November 15th 06 05:12 PM
Is it possible? DakotaNJ Excel Worksheet Functions 25 September 18th 06 09:30 PM
Compiling macro based on cell values simonsmith Excel Discussion (Misc queries) 1 May 16th 06 08:31 PM
Formula Problem - interrupted by #VALUE! in other cells!? Ted Excel Worksheet Functions 17 November 25th 05 05:18 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 04:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"