How to Run a Macro Automatically When Workbook Opens in Excel?
To run a macro automatically when the workbook opens one must enable the developer’s tools in Microsoft excel.
Steps to enable the developer’s tool:
Step 1: Go to File > Options > Customize Ribbon
Step 2: Then checkmark the Developer’s tool option in the customize ribbon option.
Now you can record Macro, run Macro and do everything that a developer can do.
Steps to run macro automatically when the workbook opens:
Step 1: Go to the developer’s menu and then go to the visual basic.
Step 2: Go to ThisWorkbook Tab.
Step 3: Write down Private Sub Workbook_open() and hit enter. You will then see the below screen.
You can write your code or basically whatever you want between this and it will automatically run every time the workbook is opened.
Let us make a Welcome Message Box:
Step 4: Save the workbook as Excel Macro-Enabled Workbook.
Note: If you don’t save it as an Excel macro-enabled workbook then it will not save the macros and it will simply save as a normal excel file.
Now, whenever you open this workbook you will see this message box pops up automatically.