When a workbook is opened in Excel, there are a few things that happen automatically in the background. One of these things is that any procedures that are set to run automatically will do so. This can be a great time-saver if you have a procedure that needs to be run every time a workbook is opened, but it can also be a hindrance if the procedure takes a long time to run or if it interferes with other things that need to happen when the workbook is opened.
To set a procedure to run automatically when a workbook is opened, first open the workbook in Excel. Then, click on the "Developer" tab in the ribbon. If you don't see the Developer tab, you can add it by going to this link. In the Developer tab, click on "Visual Basic" to open the Visual Basic Editor.
In the Visual Basic Editor, find the module that contains the procedure you want to run automatically. If you don't know which module contains the procedure, you can search for it by clicking on "Edit" in the top menu bar and then "Find and Replace". In the "Find what" field, type in the name of the procedure. Then, click on "Find All". This will bring up a list of all of the places where that procedure appears in your workbook. The module should be listed next to each instance of the procedure.
Once you know which module contains the procedure, double-click on that module in the Project Explorer window. This will open up the code for that module. At the top of the code window, there should be a line that says "Option Explicit". Below that line, type in this code:
Private Sub Workbook_Open() Call YourProcedureNameHere End Sub
Replace "YourProcedureNameHere" with the actual name of your procedure. Then, save your workbook and close it. The next time you open it, your procedure will run automatically.