• Blog
  • Excel Downloads
    • Audit Tickmark Toolbar
  • Courses
    • Power BI
  • Contact
  • Checkout

Excel Zoom

...because it's more than just a calculator


Run Macro Automatically on Open

February 4, 2009 by Mark 1 Comment

Insert your macro code into a module, start with Sub Auto_Open(). Enter whatever commands you wish to have executed on opening the file and end with End Sub. This will make Excel run macro on open and is the quickest way to run a macro automatically on opening an excel workbook.

Excel Run Macro on Open

To automatically run a macro when you open excel, follow these simple steps;

  • Open the VBA editor and create a sub called Auto_Open()
  • Enter the VBA code you wish to be executed when your workbook is opened
  • Close the Sub (End Sub) and save. Remember to save as a macro enable workbook

This is how you easily make a macro run automatically in Excel when a workbook is opened.


Sub Auto_Open()
'
'MACROS BY EXCELZOOM.COM
'
Msgbox "Hello"
End Sub

Replace “Msgbox “Hello” ” with whatever macro commands you wish to have run whenever your file is opened.

Need help? Use our nifty guide to help figure out how to install and use your macros.

Use the following if you wish to put the macro in your workbook as opposed to in a module. Again replace “Msgbox “Hello”” with your macro command:

Private Sub Workbook_Open()
'
'MACROS BY EXCELZOOM.COM
'
Msgbox "Hello"
End Sub

We hope this will help you in Excel to auto run macros and implement the functionality to run a macro when workbook opens.

Stop a macro automatically running when Opening Excel

Of course, now you know how to create a macro that runs automatically when you open Excel, it is useful to know how to prevent it.

The quickest way way prevent a macro running automatically when you open Excel is to disable macros in the Excel security settings. This will then not run the macro automatically but instead ask you for permission. You can change the settings in a different spreadsheet so you get the desired result when you open the workbook in question.

Filed Under: Macros Tagged With: Automatic, Macros

Looking For More Help?

Contact us with any specific questions or feedback. We love to hear from you!

Recommend a new product and EARN! Contact us here for info

Need to level up your career? See our amazing Excel Courses here

Looking for the Excel Audit Tickmark Toolbar? Click Here, NOW ONLY $97!

Subscribe to our mailing list
  • Facebook
  • Twitter

Search this site…

Power BI Webinar
Power BI Course
Free Excel Dashboard Webinar

Copyright © 2025 · Magazine Pro Theme on Genesis Framework

Login Form