Useful Hacks, Reviews, Tips and Tricks of anything under the moon and the sun.

Automatically run a Macro When Opening a Excel Workbook

1 comment
9:45 AM Monday morning, My first caller for the day. Local 522 is displayed on my IP phone's caller ID. I excitedly pickup the phone and started the conversation.


Hello good morning! IT Department. How may I help you?


Hi good morning. I forwarded you an excel file with some macro function on it. Can you please take a look on it? I want my excel to run the macro function every time I open the workbook. Can it be done? How?


Yes it can. I will reply to your email the answer.

Super Girl

Thanks! your my hero.

To run a Macro when opening an excel Workbook, do these steps.
1. Open your Excel's Visual Basic Editor on Tools > Macro > Visual Basic Editor.
2. Now add an Auto_Open Sub on your existing macro code. Inside the Auto_Open Sub call the function you want the excel to execute every time you open the workbook as shown below.

Sub autoopensample()
MsgBox ("Testing my Auto_Open function")
'Anthing here
End Sub
Sub Auto_Open()
End Sub

Automatically run a Macro When Opening a Excel Workbook
* Each time Excel opens, Auto_Open() will run only once when the workbook is open.

3. Now save and close the workbook.
4. Open your workbook again to test if it is working.

1 comment :