Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Running a Macro from a Spreadsheet Function
Does anyone know a method of calling/running a macro from within a cell
function (e.g. a logical IF function)? I am currently using XP Office with Excel 2002. |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Running a Macro from a Spreadsheet Function
You can't run a macro from an Excel IF function.
You may be able to run a macro from event code that is triggered by the results of an IF calculation. More details would be in order but here is sample sheet event code that runs on the results of an IF A1 fomula is =B1 * C1 Private Sub Worksheet_Calculate() On Error GoTo stoppit Application.EnableEvents = False With Me.Range("A1") If .Value < 144 Then MsgBox "Please be advised that A1 does not equal the correct amount." 'Call "your macro name" to be used instead of the msgbox End If End With stoppit: Application.EnableEvents = True End Sub Gord Dibben MS Excel MVP On Sat, 9 Feb 2008 16:19:00 -0800, Patrick (GVC) <Patrick wrote: Does anyone know a method of calling/running a macro from within a cell function (e.g. a logical IF function)? I am currently using XP Office with Excel 2002. |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Running a Macro from a Spreadsheet Function
Sat, 9 Feb 2008 16:19:00 -0800 from <?B?UGF0cmljayAoR1ZDKQ==?
= <Patrick : Does anyone know a method of calling/running a macro from within a cell function (e.g. a logical IF function)? I am currently using XP Office with Excel 2002. Make it a user-defined function. As far as I know, a function can contain any code that you could put into a macro. -- Stan Brown, Oak Road Systems, Tompkins County, New York, USA http://OakRoadSystems.com A: Maybe because some people are too annoyed by top posting. Q: Why do I not get an answer to my question(s)? A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Looking for a macro/function in an excel spreadsheet (Help) | Excel Worksheet Functions | |||
Running a Macro that enters a function that returns #VALUE! | Excel Discussion (Misc queries) | |||
disable user running macro from Tools Macro | Excel Discussion (Misc queries) | |||
How can I invoke running a macro from within an "IF" function. | Excel Worksheet Functions | |||
Prevent A Macro From Running If SpreadSheet is Filtered | Excel Worksheet Functions |