Record A Macro

You can use macros to automate a series of steps. The easiest method for creating a macro involves using the Macro Recorder option, which captures everything you do and saves it in a macro module with the name you specify. After you create the macro, you can run the macro again, modify it, or delete it.

Because the Macro Recorder records every action you perform when you use it, consider planning your steps before creating the macro. Because each macro action takes time to record, when you plan out the macro steps, the macro runs faster and more effectively. When you name a macro, use a name that starts with a letter and has no spaces in it;you can, however, use the underscore character to separate words.

Excel creates the macro with either relative or absolute reference to the cell where you apply it. You can specify the cell reference by selecting the Relative Reference button on the Stop Recording toolbar. If you select Relative Reference, the macro uses relative references, meaning that it performs the macro based upon the location of the cell. For example, you can have a macro add the values in the first four cells of a worksheet and place the total sum in a cell you select. With absolute positioning, however, the macro records in absolute mode and remembers the specific cells you use to record the macro. For example, the macro remembers always to add the same cells, such as A1 through A5, and place the total sum in cell A6. You can toggle between relative and absolute referencing while recording your macro via the Reference button.



Cell Programming

—n Click the worksheet cell to contain the results of the macro.

■ The Record Macro dialog box displays.

—n Click the worksheet cell to contain the results of the macro.

■ If you intend to use other worksheet cells in your macro, make sure the cells contain the desired values.

L-0 Click Tools O Macro O

Record New Macro.

■ The Record Macro dialog box displays.

-0 Type a unique name for the macro.

■ You can also create a keyboard shortcut for your macro by typing the desired shortcut key in the Shortcut Key field.

□ Click here to select a location where you want to store the macro.

Note: See the section "An Introduction to Macros" for more on the three areas to store a macro.

0 0

Post a comment