Wednesday, April 21, 2021

Record a macro to open specific workbooks when excel starts

Suppose you want to record a macro to open workbooks you use every day when you start Excel. You can create an Auto_Open macro to do that. You may also want to run a macro automatically when opening a workbook.

Before you get started, make sure the Developer tab is shown on the ribbon. If it's not there, do the following:

  1. Click File > Options > Customize Ribbon.

  2. Under Customize the Ribbon, in the Main Tabs box, check the Developer box.

  3. Click OK.

To open workbooks automatically when Excel starts:

  1. Click Developer > Record Macro.

Code group on the Developer tab

  1. In the Macro name box, type Auto_Open.

  2. In the Store macro in box, pick Personal Macro Workbook.

  3. This will make the macro available every time you open Excel.

  4. To remind you what this macro does, enter a description in the Description box. You can also leave this box blank.

  5. Click OK.

  6. Click File > Open, and select the files you work on every day. The files can be in multiple locations. Press Shift to select multiple files in the same folder.

  7. Click Developer > Stop Recording.

  8. When you close Excel, you'll eventually be prompted to save the changes you've made to the Personal Macro Workbook. Click Yes so that your macro will run whenever you start Excel.

    Each time you start Excel, the workbooks you included in the macro will automatically open.

No comments:

Post a Comment