The tutorial shows how to create and use the Personal.xlsb file to make Excel macro available in all workbooks.
Normally, when you write a macro in Excel, it can only be accessed from that specific workbook. But what if you want to use it in other files too? Recreating the same macro for each and every workbook does not sound like a good idea. Instead, store your popular VBA codes in the Personal Macro Workbook. This will make the macros accessible every time you open Excel, in any workbook!
Personal Macro Workbook is a special file named Personal.xlsb in Excel 2007 – 2019 or Personal.xls in earlier versions. Any macros stored in this file are available to you whenever you start Excel. A great thing about the personal workbook is that it's hidden by default, so you won't ever notice it opening in the backend. No actions on your side are required. Microsoft Excel just knows the location where this file lives in your system and looks for it automatically on every launch.
Aside from macros, the Personal Macro Workbook can store your custom functions (user-defined functions) written in VBA.
A fly in the ointment is that the Excel Personal Macro Workbook does not exist by default. To create it, you will need to record at least one macro. Once the Personal.xlsb file is created, you can add any other macros to it by using the VB Editor.
The Personal.xlsb file is stored in the XLSTART folder in the following locations.
On Windows 10, Windows 7, and Windows Vista:
C:\Users\User Name\AppData\Roaming\Microsoft\Excel\XLSTART
On Windows XP:
C:\Documents and Settings\User Name\Application Data\Microsoft\Excel\XLSTART\
Please note that the AppData folder is hidden by default. So, to get to the XLSTART folder in Windows Explorer, check the Hidden items box on the View tab.
To make your personal macro workbook, you need to record any macro, which is done via the Developer tab. So, before we get started, please make sure the Developer tab is activated in your Excel.
To create the Excel Personal Macro Workbook, carry out these steps:
This message will appear every time you create a new macro or update an existing macro in your personal workbook.
Done! The Personal.xlsb file is created and will be automatically opened in the background every time you start Excel.
Now that you have a personal macro workbook, how do you place macros into it? There are four different ways to do this:
Once the Personal.xlsb file is saved on your computer, you can view, create and edit the macros the Visual Basic Editor. Also, you can copy the code you wish to reuse from another workbook.
To create or edit a macro in your personal workbook, this is what you need to do:
Macros stored in your personal workbook can be used in any Excel file. For this, just open the worksheet in which you want to run the macro, and do the following:
You can also assign a custom shortcut to a macro or run it by clicking a special macro button.
Like any other VBA code, the macros stored in Personal.xlsb can be exported to a .bas file.
To export your personal macro workbook, here's what you need to do:
To import a .bas file that someone shared with you, right-click the module under PERSONAL.XLSB into which you want to place the macros, and select Import File.
In case you'd like to share your personal workbook with other people, proceed in one of the following ways.
The easiest way to share a personal macro workbook with someone is to send them a copy of your Personal.xlsb file as attachment, or save it to a cloud storage or your local network. And then, other persons can put your Personal.xlsb file in their XLSTART folder. See where Personal.xlsb is located.
This simple approach, however, can be dangerous in case the other person already has his/her own macros in the Personal.xlsb file. So, I'd recommend replacing this file only on your own devices when you are absolutely sure you won't mess up anything.
If you want to share just a few macros from your Personal.xlsb file, you can copy those macros to another workbook, and email that workbook to other users. For the detailed steps, please see How to copy macros to another workbook.
A professional-like way is to move all the macros you wish to share into one module and export that module as a .bas file. Send the .bas file to other users by email, and they will be able import it as a new module into their Personal.xls file.
If one day you open Excel and find out that your favorite macros are no longer there, don't panic! Most likely, the Personal.xlsb file was disabled by Excel after a crash, update, or for whatever reason.
Here are the steps to get your personal workbook up and running again:
By default, the Personal Macro Workbook should not be visible in Excel. If the Personal.xlsb file keeps opening whenever you use macros and this really bugs you, you can hide it in this way:
That's it! From now on, the personal workbook will be hidden from view but still launch in the background, so you could access the macros stored there.
To make your personal macro workbook visible, this is what you need to do:
If you'd like to completely remove the Personal Macro Workbook from your computer, delete the Personal.xlsb file from the XLSTART folder. Here's how:
C:\Users\User Name\AppData\Roaming\Microsoft\Excel\XLSTART\
That's how to make your favorite Excel macros available in all workbooks. I thank you for reading and hope to see you on our blog next week!
8 responses to "Personal Macro Workbook in Excel - make macros available in all workbooks"
Thank you Ms. Svetlana for writing this blog. It was *exactly* what I needed and more. I found your post through a Bing search, but will be exploring your website and products later. Thanks again and God bless. --Jeff Fuhr
Tried creating a macro and save it to a Personal Macro Workbook, but got an error message that said,
"Personal Macro Workbook in the startup folder must stay open for recording." I have no idea what this means. I see nothing about it in the startup folder. When I clicked OK, I was further informed that the macro would not record. Please help.
Hey Paul -
Search for the PERSONAL.XLSB file and open it. Once open, click: View > Hide.
On the workbook you are trying to create a macro in, click "Record Macro" again, should work!
I created personal macro for Pivot Table creation but when I run this on other files, it gives me runtime error. Any suggest to fix it ?
Thanks
I have one knowledge about Personal.xlsb If I want to open 2 instances of Excel in Office2010, the second of them blocked Personal.xlsb because it is used by the first instance. Thus, either Personal must be checked "read-only" or Personal must be listed as shared. However, in both cases, macros cannot be edited. So this is a bit ill-conceived (MS) :(((
But I tried something and editing macros also works in a shared file (any) !!! Cancel sharing / open the file in the archiver (winrar, 7-zip, etc ...) / folder xl, file vbaProject.bin -> extract file (for example to the Desktop) / share the excel file again / reopen the excel file with the archiver and insert the original vbaProject.bin --> VBA can be edited in the shared file ;)
Hello Svetlana,
I have created macro enabled file. Created a button and attached this macro to it.
Now i want to share this excel file with users.
But I dont want to restrict users to save files on specific paths like -
C:\Users\usrname\AppData\Roaming\Microsoft\Excel\XLSTART
Is there any way to avoid this step.
As a user when I received macro enabled file and xlsb file. I would simply download attachments and save them to any random path I wish to. And start using macro functionalities.
Basically, end user should not bother about the technicality of xlsb.
How to edit ms Excel online?