Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell contents is a macro
Hi everyone,
Is it possible for the contents of a cell to be the result of a macro, so that observable behaviour similar to a formula is achieved (ie: it automatically recalculates the cell contents if any of the values the formula uses changes?) - I ask this because I need the cell to display the results of a calculation which is difficult and error prone to do in one line, whereas the use of VBA would be good. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell contents is a macro
read help on User Defined Functions
eg PUBLIC FUNCTION MyFunc(var1,var2,var3) as double ' my formula here 'Dim Result as Double Result = (var1 + var2) / var3 MyFunc = Result END FUNCTION This should be placed on a standard code module Patrick Molloy Microsoft Excel MVP "Tagas" wrote: Hi everyone, Is it possible for the contents of a cell to be the result of a macro, so that observable behaviour similar to a formula is achieved (ie: it automatically recalculates the cell contents if any of the values the formula uses changes?) - I ask this because I need the cell to display the results of a calculation which is difficult and error prone to do in one line, whereas the use of VBA would be good. Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell contents is a macro
Tagas,
You can create Public user defined functions in .bas in the VBA. Also, look into Volatile for recalculation modes. NickHK "Tagas" wrote in message ... Hi everyone, Is it possible for the contents of a cell to be the result of a macro, so that observable behaviour similar to a formula is achieved (ie: it automatically recalculates the cell contents if any of the values the formula uses changes?) - I ask this because I need the cell to display the results of a calculation which is difficult and error prone to do in one line, whereas the use of VBA would be good. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to transfer contents of 'Selected' cell to alternate cell. | Excel Worksheet Functions | |||
'IF' Macro to insert cell contents to alternate cell if cell not e | Excel Worksheet Functions | |||
Macro that looks at cell contents | Excel Discussion (Misc queries) | |||
Macro to remove contents of cell and move all other contents up one row | Excel Discussion (Misc queries) | |||
Please help! Macro to change cell contents based on cell to the left | Excel Programming |