We are in the process of updating the site, so some pages still have the older design.
How to make a macro run automatically after a workbook is opened and before anything else happens.
You need this macro code:
Private Sub Workbook_Open()
'simple message box that will pop-up and say "Hi!" to show you that the macro is working
MsgBox "Hi!"
End Sub
The trick is that you must put this macro code into ThisWorkbook





Make sure to download the accompanying workbook to see this macro in action.
Doing this does not mean that a macro will always run when a workbook is opened. Due to security features in Excel, many workbooks will have macros turned off by default. In order for this to run, the macros have to be enabled.
You may see a warning when you open a workbook with a macro in it and you will then have to enable the macros from that warning.
However, some people will have all macros turned off without notification, which means they will not see an option to turn them on.
All of this just means that you cannot plan for all of your users to have macros turned on by default and, as such, you shouldn't have mission-critical macros run in this manner.
In another tutorial, I'll show you how to make users enable their macros in order to view the workbook so that a problem like this can be avoided.
Follow along with the tutorial by downloading the files used in it. (Completely Free)
Phone number is optional - we use it to send course discounts and weekly updates via SMS.