Edit a Basic Macro in Excel – Tutorial

Edit a Basic Macro in Excel

This lesson shows you how to edit a basic macro in Excel. Before you go through this tutorial, check out creating a basic macro in Excel first. As always, you can still follow along.

Steps to Edit a Basic Macro in Excel

Follow the steps below to edit a macro in Excel.

Step 1: Open a File Containing a Macro and Show Developer Ribbon

If you do not have any Excel files containing code, then check out creating a basic macro in Excel. Otherwise, open the file containing the macro.

Developer ribbon.
Developer ribbon.

Click the Developer tab.

Step 2: Show Macro Dialog Box
Developer ribbon with Macros item selected.
Developer ribbon with Macros item selected.

Click Macros under the Code group within the Developer ribbon.

The Macro dialog box opens.

Step 3: Select Macro Name to Edit
Macro dialog box.
Macro dialog box.
  1. Select your macro. In our case Hello_World.
  2. Click Edit.

The Microsoft Visual Basic for Applications (VBA) opens, such as below.

VBA window.
VBA window.
Step 4: Make Edit to the Code
Module editor.
Module editor.

Change “Hello World!” to something else, like “Have a nice day!”.

Press Ctrl-S to save.

Note: You may want to delete Range(“A2”).Select, as it basically moves the cursor to cell A2. It is up to you.

Test Edit to Macro

Return back to your sheet and follow the steps below to test your changes.

Step 1: Show Macros
View Macros item under the Code group.
View Macros item under the Code group.

Click the Macros item in the Code group under the Developer tab. This will show the Macro dialog box.

Step 3: Find Your Macro and Run It
Macro dialog box.
Macro dialog box.

From the macro list, select your macro. In our case, Hello_World. Click Run.

After you clicked Run, you should see “Have a nice day!” in a cell.

Success!

Completed changes to your macro.

Additional Information

Questions and Comments

Contact us at training@techronology.com with any questions or comments.

Related Tutorials


Tutorials

Techronology Home