Excel 2016 Macros

Lesson 3 – Editing Macros

Excel 2016

Steps

Practice Data

4. Resize or maximize the Code window, as desired. The Code window is maximized. 5. Position the insertion point above or below any existing macros in the Code window. The insertion point is placed below the existing macros in the Code window.

Click

Press [Ctrl+End]

6. Type Sub .

Type Sub

The Sub command appears at the insertion point.

7. Press [Spacebar] .

Press [Spacebar]

A space appears after the Sub command.

8. Type the macro name, followed by a set of parentheses ( ( ) ). The text and parentheses appear at the insertion point. The insertion point moves to the next line, the End Sub command appears on the line below the insertion point and a horizontal line appears above the Sub command. The macro name is displayed in the macro name list at the top of the Code window. 9. Press [Enter] .

Type Open_Cities()

Press [Enter]

E NTERING M ACRO C OMMENTS  D ISCUSSION

When macros are first recorded, the recording process documents the name, date, and other macro descriptions in the Code window. This information appears before the actual macro statements. If you make a change to a macro, you should go into the documentation area of the macro and edit this information as necessary. For example, if you add a shortcut key to a macro after the macro has been recorded, this information is not automatically added to the macro documentation. You must manually add a line to document the change.

Page 44

OFFICEPRO, Inc.

Made with FlippingBook - professional solution for displaying marketing and sales documents online