ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run a macro at startup (https://www.excelbanter.com/excel-programming/287494-run-macro-startup.html)

Robyn Thomas

Run a macro at startup
 
I have a macro that I need to run in an Excel file when
the worksheet opens.

Any ideas?

Robyn

Rob van Gelder[_4_]

Run a macro at startup
 
Robyn,

You can use the Workbook_Open event under ThisWorkbook

eg.
Private Sub Workbook_Open()
MsgBox "Hello!"
End Sub

Or you can include a Sub in one of the modules called: Auto_Open
(I think this is an older way of doing it - you should use Workbook_Open)

eg.
Sub Auto_Open()
MsgBox "Hello!"
End Sub

Rob


"Robyn Thomas" wrote in message
...
I have a macro that I need to run in an Excel file when
the worksheet opens.

Any ideas?

Robyn





All times are GMT +1. The time now is 11:38 PM.

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