Making a Macro Run Automatically

  • Thread starter Thread starter ElsiePOA
  • Start date Start date
E

ElsiePOA

My mind has gone blank. I have a Macro which I want to have ru
automatically every time I open any Workbook, but I have forgotten ho
to make it do that.

*HELP!
 
Hi Elsie

Sub Auto_open()
MsgBox "Hi"
End Sub

Must be in a normal module
If you use a Auto_open macro then this wil not run if you open the file with a macro

Or a event

Private Sub Workbook_Open()
'macro name or code
End Sub

Right click on the Excel icon next to File in the menubar
And choose View code

You are now in the Thisworkbook module
Paste the Event in this place
Alt-Q to go back to Excel
Save and close the file

Read Chip Pearson's site about Events
http://www.cpearson.com/excel/events.htm
 
Thanks Ron

What I was really wondering however is whether you can cause a macro t
run automatically whenever you open *ANY* workbook, or is it necessar
to do the Workbook-Open procedure individaully in each workbook
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top