Discussion Locked

Excel - execute macro on opening

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I would like to automatically execute a macro whenever a workbook is opened.

Thanks

Joe

3 replies

by charliespencer

Aw c'mon, did you even -try- to use the built-in Help function? What are you a consultant on?

Click Help.
In the Search box, enter "macros".
In the Search results, click "Run a macro".
Now click "Have a macro run automatically..."

These steps are detailed for Excel 2003. The sequence may be different for other versions; your mileage may vary. Offer void where prohibited.

by jjoc11762

Thanks very much.
I am retired - used to manage the installation of PeopleSoft HR systems etc.

I am fooling around with VBA

Thanks

by bschaettle

Joe,
You need to code an event handler for the "Open" event of the workbook, which is really easy. Just paste this code into the VBA editor:

Private Sub Workbook_Open()
MsgBox "You opened the workbook."
End Sub

This discussion is closed to new replies.