1. Open an empty Excel document first, enter File-options-customize Ribbon, on the right
Main tabs Find developer and tick, so in Excel you will see developer this tab
2. Click on the new tab below to create a tab and create a group backup, tab and
Group name can be filled in the desired name, such as tab for May macros,group for production
Status
3. Find the record Macro in developer, specify Marco's name, in the store macro in place
Select Personal Macro Workbook, click OK to confirm
4. Click the Stop Record, then click Visual Basic to enter the VBE and find VBAProject on the left.
(PERSONAL. XLSB)-modules Find the macro you just recorded, modify and enter the code you want to execute, complete
Then click Save
5. Close all open Excel documents, such as prompt to save changes to PERSONAL.XLSB Select Yes
6. File-options-customize Ribbon, select the new group in the right main tabs,
Then select macros in the middle customize the Ribbon and select
PERSONAL.XLSB in the macro, click Add added to the new group, you can click Rename to re-kill
Name and specify the icon to use, click OK to save the changes
When you open any Excel document on that computer, you can see the new group under the tab and the macro icon inside it.
, click to run it.
Complete!
If you want to use this macro for other computers, you can open the following directory c:\users\<username>
\appdata\roaming\microsoft\excel\xlstart, find the inside.
PERSONAL.XLSB, copy to the appropriate directory for your new computer, and then follow the steps above.
When writing the macro code, be aware that if you are using ThisWorkbook and so on, the ThisWorkbook means
Is the PERSONAL.XLSB, not the Excel document you open, you typically use the
Activewrokbook Replace or something else.
Add a macro to the custom Ribbon and run it in all Excel methods