Excel 2016 Macros

Excel 2016

Lesson 3 – Editing Macros

Steps

Practice Data

1. Position the insertion point where you want to insert the command. The insertion point is placed in the desired location.

Click at the end of the Workbooks.Open Filename:= "CHICAGO.XLSX" text

2. Press [Enter] .

Press [Enter]

A new line is inserted.

3. Type the desired command. As you enter t he text, an Auto Quick Info box appears until you complete typing the command. 4. To enter a property or method, type a period ( . ).

Type Workbooks("CITY59.XLS M")

Type a period ( . )

An Auto List Member list displays available properties or methods.

5. Type the desired property or

Double-click Activate

method, or select it from the Auto List Member list. The property or method appears in the command.

6. Press [Enter] .

Press [Enter]

The command syntax is verified.

Press [Alt+F11] to switch to the worksheet window. Select the Macros button in the Code group and run the Open_Cities macro. When the macro finishes running, the CITY59.XLSM workbook should be active and the TAMPA.XLSX , ATLANTA.XLSX , and CHICAGO.XLSX workbooks have opened. Then, run the Close_Cities macro. All workbooks should close, except the CITY59.XLSM workbook.

R UNNING A M ACRO FROM THE C ODE W INDOW  D ISCUSSION

During the editing process, a macro can be run directly from the Visual Basic Editor using the Run Sub/UserForm button on the Standard toolbar or the corresponding command located in the Run menu.

You must position the insertion point in the Code window, within the text of the macro you want to run. Otherwise, the Macros dialog box will open from which you must select and run the desired macro.

OFFICEPRO, Inc.

Page 53

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