ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro (https://www.excelbanter.com/excel-programming/277991-macro.html)

George Hanna

macro
 
looking for the command to automate a macro to run on
worksheet open and on close

J.E. McGimpsey

macro
 
If you call your macro from the Workbook_Open() event it will fire
when the workbook opens:

Private Sub Workbook_Open()
MyMacro
End Sub

This needs to be put in the ThisWorkbook code module, with MyMacro
in a regular code module. To fire before close (also in the
ThisWorkbook code module):

Private Sub Workbook_BeforeClose(Cancel As Boolean)
MyOtherMacro
End Sub


In article ,
"George Hanna" wrote:

looking for the command to automate a macro to run on
worksheet open and on close



All times are GMT +1. The time now is 01:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com