Add a macro to the custom Ribbon and run it in all Excel methods

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.