Discussion Locked

Running macros on opening

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Can somebody please explain how to run microsoft excel macros when the worksheet is opened?

5 replies

by jonesie.c

When in the Workbook go in to the VBA Editor. You do this by pressing the Alt+F11 key's.

Double click on the ThisWorkbook object on the left - a new window wil appear.

Type the follong into the new window.

Private Sub Workbook_Activate() 'remove there two lines of text and
'type your code here
End Sub

For Example:-

Private Sub Workbook_Activate()
MsgBox("Hello")
End Sub

This discussion is closed to new replies.