Skip to content
Related Articles

Related Articles

Improve Article

How to Run a Macro Automatically When Workbook Opens in Excel?

  • Last Updated : 09 May, 2021
Geek Week

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.

Output:

Now, whenever you open this workbook you will see this message box pops up automatically.

Attention reader! Don’t stop learning now. If you are an Excel beginner (or an intermediate) and want to learn Excel, Geeksforgeeks brings the perfect course for you to start, Diving Into Excel

My Personal Notes arrow_drop_up
Recommended Articles
Page :