Excel 2016 Macros

Lesson 3 – Editing Macros

Excel 2016

W RITING A N EW M ACRO  D ISCUSSION

New macros can be created by recording the steps or typing the commands directly into the Code windows in the Visual Basic Editor. To write a new macro, you must begin by typing the word Sub , followed by the macro name and a set of parentheses ( ( ) ). Excel automatically supplies the End Sub command. All steps in the procedure must be entered between the Sub and End Sub commands.

New macros can be inserted in an existing module or added to a new module. You can insert a macro above or below any existing macro; the position of the macro in the module does not affect its performance.

Writing a new macro

NOTE You can create a new module in a Visual Basic project by selecting the Insert menu and then clicking Module . A new module with an incremental number, such as Module3 , will then be inserted into the current project. When you insert a macro above or below an existing macro in a module, the Visual Basic Editor automatically inserts horizontal lines between macros to separate them.

Page 42

OFFICEPRO, Inc.

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