- Excel Macros Tutorial
- Excel Macros - Home
- Excel Macros - Overview
- Excel Macros - Creation
- Macros in a Single Workbook
- Excel Macros - Security
- Excel Macros - Absolute References
- Excel Macros - Relative References
- Excel Macros - VBA
- Excel Macros - Understanding Codes
- Assigning Macros to Objects
- Excel Macros - Running a Macro
- Creating a Macro Using VBA Editor
- Excel Macros - Editing
- Excel Macros - UserForms
- Excel Macros - Debugging a Code
- Excel Macros - Configuring a Macro
- Excel Macros Useful Resources
- Excel Macros - Quick Guide
- Excel Macros - Useful Resources
- Excel Macros - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Excel Macros - Macros in a Single Workbook
Excel provides you with a facility to store all your macros in a single workbook. The workbook is called Personal Macro Workbook - Personal.xlsb. It is a hidden workbook stored on your computer, which opens every time you open Excel. This enables you to run your macros from any workbook. There will be a single Personal Macro Workbook per computer and you cannot share it across computers. You can view and run the macros in your Personal Macro Workbook from any workbook on your computer.
Saving Macros in Personal Macro Workbook
You can save macros in your Personal Macro Workbook by selecting it as the storing option while recording the macros.
Select Personal Macro Workbook from the drop down list under the category Store macro in.
- Record your second macro.
- Give macro details in the Record Macro dialog box as shown below.
- Click OK.
Your recording starts. Create a table as shown below.
Click the VIEW tab on the Ribbon.
Select View Macros from the dropdown list. The Macro dialog box appears.
The macro name appears with a prefix PERSONAL.XLSB! indicating that the Macro is in the Personal Macro Workbook.
Save your workbook. It will get saved as an .xls file as the macro is not in your workbook and close Excel.
You will get the following message regarding saving the changes to the Personal Macro Workbook −
Click the Save button. Your macro is saved in the Personal.xlsb file on your computer.
Hiding / Unhiding Personal Macro Workbook
Personal Macro Workbook will be hidden, by default. When you start Excel, the personal macro workbook is loaded but you cannot see it because it is hidden. You can unhide it as follows −
Click the VIEW tab on the Ribbon.
Click Unhide in the Window group.
The Unhide dialog box appears.
PERSONAL.XLSB appears in the Unhide workbook box and click OK.
Now you can view the macros saved in the personal macro workbook.
To hide the personal macro workbook, do the following −
- Click on the personal macro workbook.
- Click the VIEW tab on the Ribbon.
- Click Hide on the Ribbon.
Running Macros Saved in Personal Macro Workbook
You can run the macros saved in personal macro workbook from any workbook. To run the macros, it does not make any difference whether the personal macro workbook is hidden or unhidden.
- Click View Macros.
- Select the macro name from the macros list.
- Click the Run button. The macro will run.
Adding / Deleting Macros in Personal Macro Workbook
You can add more macros in personal macro workbook by selecting it for Store macro in option while recording the macros, as you had seen earlier.
You can delete a macro in personal macro workbook as follows −
- Make sure that the personal macro workbook is unhidden.
- Click the macro name in the View Macros dialog box.
- Click the Delete button.
If the personal macro workbook is hidden, you will get a message saying “Cannot edit a macro on a hidden workbook”.
Unhide the personal macro workbook and delete the selected macro.
The macro will not appear in the macros list. However, when you create a new macro and save it in your personal workbook or delete any macros that it contains, you will be prompted to save the personal workbook just as in the case you saved it first time.