Running a macro automatically in Excel allows predefined actions to execute when a workbook opens. It helps automate startup tasks like showing messages, initializing data, refreshing reports, or performing calculations. Using VBA and the Workbook_Open() event, macros can run automatically whenever the workbook is launched.
How 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.
How 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.

Macro Might Not Run Automatically
Even though you set up a macro to activate upon opening a workbook, it's important to note that this does not guarantee automatic execution. Excel's bui;t-in security measures often default to disabling macros in many workbooks. To ensure successful execution, users must enable the macros explicitly.
Upon opening a workbook with macros, you might encounter a cautionary prompt that requires you to authorize the macro;s execution. This step is crucial for the macro the function properly.
However, Certain individuals might have macros deactivated without receiving any notification, depriving them of the option to activate macros.
These considerations highlights the fact that you cannot assume all users will have macros enable by default. Consequently, it's advised to rely on this method for executing vital macros that are central to critical operations.
Also Read :