Thursday, July 26, 2018

Copy your macros to a Personal Macro Workbook

Copy your macros to a Personal Macro Workbook

If you find yourself recreating the same macros, you can copy those macros to a special workbook called Personal.xlsb that is saved on your computer. Any macros that you store in your personal workbook become available to you whenever you start Excel on that same computer.

This is different than Excel's default behavior, where a macro only works in the workbook that contains it.

To create the personal workbook, you first need to create a macro and store it in the Personal Macro Workbook. Before you get started, make sure that the Developer tab is available in the ribbon in Excel. See Show the Developer tab for more information.

Create and update the Personal Macro workbook

  1. On the Developer tab, in the Code group, click Record Macro.
    Record Macro

  2. In the Record Macro dialog box, type a meaningful name for the macro in the Macro name box. Make sure you don't use any spaces in the name.

  3. In the Store macro in box, select Personal Macro Workbook.
    Record Macro dialog box

  4. Click OK.

  5. Perform the actions that you want to record.

  6. On the Developer tab, in the Code group, click Stop Recording.
    Stop Recording

  7. Close the workbook.

    A message appears that prompts you to save the changes that you made to the Personal Macro Workbook.

  8. Click Save to save the workbook.

Any time you create a new macro and save it in your personal workbook or update any macros that it contains, you are prompted to save the personal workbook just as it did the first time you saved it.

Sharing macros

If you want to copy macros from the personal workbook to another workbook or vice versa, you can do so in the Visual Basic Editor (VBE). You can start the Visual Basic Editor in Excel by pressing ALT+F11. For more information about copying a macro from one workbook to another, see Copy a macro module to another workbook.

If you want to share your Personal.xlsb file with others, you can copy it to the XLSTART folder on other computers. In Windows 10, Windows 7, and Windows Vista, this workbook is saved in the C:\Users\user name\AppData\Local\Microsoft\Excel\XLStart folder. In Microsoft Windows XP, this workbook is saved in the C:\Documents and Settings\user name\Application Data\Microsoft\Excel\XLStart folder. Workbooks in the XLStart folder are opened automatically whenever Excel starts, and any code you have stored in the personal macro workbook will be listed in the Macro dialog,

If you have one, or just a few macros that you want to share with others, you can send them the workbook that contains them in an email. You can also make the workbook available on a shared network drive, or from a SharePoint Services library.

To create the personal workbook, you first need to create a macro and store it in the Personal Macro Workbook. Before you get started, make sure that the Developer tab is available in the ribbon in Excel. To do that:

On the Excel menu, click Preferences... > Ribbon & Toolbar. In the Customize the Ribbon category, in the Main Tabs list, select the Developer check box, and then click Save.

Create and update the Personal Macro workbook

To create the personal workbook, you first need to create a macro and store it in the Personal Macro Workbook.

  1. On the Developer tab, click Record Macro.

  2. In the Record Macro dialog box, type a meaningful name for the macro in the Macro name box. Make sure you don't use any spaces in the name.

  3. In the Store macro in box, select Personal Macro Workbook.

  4. Click OK.

  5. Perform the actions that you want to record.

  6. On the Developer tab, click Stop Recording.

  7. Save the changes, then close the workbook, and finally close Excel.

    A message appears that prompts you to save the changes that you made to the Personal Macro Workbook.

  8. Click Save to save the workbook.

Any time you create a new macro and save it in your personal workbook, or update any macros already in it, you'll be prompted to save the personal workbook.

Sharing macros

If you want to copy macros from your personal workbook to another workbook or vice versa, you can do so in the Visual Basic Editor (VBE). You can start the Visual Basic Editor in Excel by clicking Visual Basic in the Developer tab. For more information about copying a macro from one workbook to another, see Copy a macro module to another workbook.

If you want to share your Personal.xlsb file with others, you can copy it to the Excel home folder on other computers. That folder for Mac is in the home folder at ~/Library/Containers/com.microsoft.Excel/Data/Library/Application Support/Microsoft/Roaming/Excel/.

If you have one, or just a few macros that you want to share with others, you can send them the workbook that contains them in an email. You can also make the workbook available on a shared network drive, or from a SharePoint Services library.

Need more help?

You can always ask an expert in the Excel Tech Community, get support in the Answers community, or suggest a new feature or improvement on Excel User Voice.

Top of Page

No comments:

Post a Comment