相關主題
×
Work with macros
使用 Microsoft 登入
登入或建立帳戶。
您好:
選取其他帳戶。
您有多個帳戶
選擇您要用來登入的帳戶。
英文
很抱歉,此文章目前沒有您所使用語言的版本。
Work with macros

Edit a macro

Your browser does not support video. Install Microsoft Silverlight, Adobe Flash Player, or Internet Explorer 9.

Watch this video to see how to edit a macro in a special text editor called the Visual Basic Editor. Visual Basic is the programming language that macros are recorded in.

First, show the Developer tab

The DEVELOPER tab, on the ribbon, is where all of the macro commands are.

  • To have it appear on the ribbon, click FILE > Options > Customize Ribbon, check Developer, and click OK.

  • On the DEVELOPER tab, in the Code group, are the Record Macro button and some other buttons that will come in handy.

Create a macro using Visual Basic

  1. Click DEVELOPER > Visual Basic.

  2. If needed, in the Visual Basic Editor, on the Insert menu, click Module.

    Note:  Modules are automatically created for all sheets in the workbook.

  3. In the code window of the module, type or copy the macro code that you want to use.

  4. To run the macro from the module window, press F5.

  5. In the Visual Basic Editor, on the File menu, click Close and Return to Microsoft Excel when you finish writing the macro.

Edit the macro

  1. On the DEVELOPER tab, in the Code group, click Macros.

  2. In the Macro name box, click the macro that you want to edit.

  3. Click Edit. The Visual Basic Editor appears.

Want more?

Create or delete a macro

Edit a macro

Assign a macro to a button

Create and save all your macros in a single workbook

需要更多協助嗎?

想要其他選項嗎?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

這項資訊有幫助嗎?

以下何者是您會在意的事項?
按下 [提交] 後,您的意見反應將用來改善 Microsoft 產品與服務。 您的 IT 管理員將能夠收集這些資料。 隱私權聲明。

感謝您的意見反應!

×