Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro auto run
is it possible to have a macro run automatically using an "if" statemen
-- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro auto run
If you mean an IF statement in a worksheet, then no. Worksheets can only
call functions that return a result, they cannot run a macro that modifies the Excel environment. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "nightshift12 " wrote in message ... is it possible to have a macro run automatically using an "if" statement ? --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro auto run
In VBA you can choose which macro to run using any of the conditional
statements, so If condition then Call macro1 else Call macro2 endif of more simply for just one macro If condition then call macro1 Cheers Nigel "nightshift12 " wrote in message ... is it possible to have a macro run automatically using an "if" statement ? --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro auto run
If is a conditional test, and can be in a sheet function
or in code. In a sheet function, only the content of the calling cell can be changed - a sheet function cannot alter th evalues in other cells. In code, your IF can be in a procedure - sub if you will- where the called routine can pretty much do whatever you want. Now, running a macro automatically means what? If yuo want code to start when a workbook opens, then use a proc called Auto_Open or use the workboook's Open event. If you want code to run when a cell value changes, then you coul duse the Sheet's Change event - this is fired when a value is entered. ou could also use the workbook's SheetCalculate event that is fired when a sheet is calculated. Patrick Molloy Microsoft Excel MVP -----Original Message----- is it possible to have a macro run automatically using an "if" statement ? --- Message posted from http://www.ExcelForum.com/ . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Auto run macro | Excel Worksheet Functions | |||
Sub Macro vrs Function Macro Auto Start | Excel Discussion (Misc queries) | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Macro Auto Run(2) | Excel Worksheet Functions | |||
Macro - Auto Run | Excel Worksheet Functions |