![]() |
How to autostart a macro?
Can a macro be self-starting based on some event?
Events such as: 1) opening the file 2) preset time 3) value of certain cell contents Trying to set a spreadsheet to run a series of queries and macros every night. Also hope to learn if i can set up a series of queries and macros to run in sequence whether autostart or not. Could these macros run even if the Excel file is not open? |
How to autostart a macro?
#1. You can use a sub named: Auto_Open (placed in a General module)
or you can use the Workbook_Open event in the ThisWorkbook module. #2. You can use application.ontime to start a macro when you want. Chip Pearson shows how: http://www.cpearson.com/excel/OnTime.aspx #3. If the value changes because of the user typing something, you can use the worksheet_change. If the value changes because of a formula recalculating, you can use the worksheet_calculate event. If you're new to macros: Debra Dalgleish has some notes how to implement macros he http://www.contextures.com/xlvba01.html David McRitchie has an intro to macros: http://www.mvps.org/dmcritchie/excel/getstarted.htm Ron de Bruin's intro to macros: http://www.rondebruin.nl/code.htm (General, Regular and Standard modules all describe the same thing.) Chip Pearson has some instructions on events: http://www.cpearson.com/excel/events.htm David McRitchie has some notes, too: http://www.mvps.org/dmcritchie/excel/event.htm There are application events, too. You can read more about application events at Chip Pearson's site: http://www.cpearson.com/excel/AppEvent.aspx Delivery wrote: Can a macro be self-starting based on some event? Events such as: 1) opening the file 2) preset time 3) value of certain cell contents Trying to set a spreadsheet to run a series of queries and macros every night. Also hope to learn if i can set up a series of queries and macros to run in sequence whether autostart or not. Could these macros run even if the Excel file is not open? -- Dave Peterson |
All times are GMT +1. The time now is 10:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com