Excel 2016 Macros

Excel 2016

Lesson 3 – Editing Macros

In longer and more complex macros, you can add comments to the various macro steps. Comments can explain what a step or series of steps should accomplish. This information can be helpful if the macro must be modified or debugged later.

Comments must begin with a single apostrophe ( ' ). Excel treats any line that begins with a single apostrophe as a comment. Comments can appear either on a separate line or adjacent to a macro statement. Comments appear in black text when they are entered and change to green text as soon as you move to another line.

Entering macro commands in the Code window

P ROCEDURES

1. Open the workbook containing a macro to which you want to add a comment and enable the macros. 2. Display the Developer tab on the Ribbon .

3. Select in the Code group to open the Visual Basic Editor. 4. Display the module containing the macro in which you want to add the comment. 5. Resize or maximize the Code window, as desired. 6. Position the insertion point where you want to add the comment. 7. Type an apostrophe ( ' ). 8. Press [Spacebar] . 9. Type the desired comment text. 10. Press [Enter] .

OFFICEPRO, Inc.

Page 45

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