Page 306 - Excel Workbook for Dummies
P. 306
32_798452 ch22.qxp 3/13/06 7:48 PM Page 289
Chapter 22: Using Macros 289
and Name and not a space as you would when naming a cell range in the work-
sheet) and then click Shortcut key text box.
3. Type an uppercase C so that the Shortcut key appears as Ctrl+Shift+C.
4. Select Personal Macro Workbook on the Store Macro In option’s drop-down list.
5. Select the Description text box and then insert the following additional informa-
tion before the stock Macro recorded followed by the current date and by fol-
lowed by your name:
Enters company name in 12-point bold centered across five columns -
6. Select OK to close the Record Macro dialog box.
7. Click the Relative Reference button in the Stop Recording toolbar.
Excel indicates that is recording relative cell references by highlighting the back-
ground of the Relative Reference.
8. Type Mind Over Media, Inc. in cell A1 and then click the Enter button on the
Formula bar.
9. On the Formatting toolbar, use the Font Size button to increase the point size to
12 and the Bold button to add the boldface attribute to the text.
10. Drag through the cell range A1:E1 to select it and then click the Merge and
Center button on the Formatting toolbar.
11. Click the Stop Recording button on the Stop Recording toolbar.
12. Position the cell cursor in cell G1 in Sheet1 and then press Ctrl+Shift+C to test
the rerecorded Company_Name with relative cell references.
This time, thanks to relative cell references, the macro works as intended by
entering the formatted company name, Mind Over Media, Inc., centered across
the merged cell in the range G1:K1.
Next, record another macro that enters all 12 months (from January to
December) in a single row of the worksheet. This macro enters the names of the
months, and then makes their names bold and italic and widens their columns
with the AutoFit feature. This Twelve_Months macro also requires relative refer-
ences during recording to ensure that you can use it to successfully the months
of the year in any columns of any worksheet.
13. Position the cell cursor in cell A4 of Sheet 1 and then choose the Tools➪Macro➪
Record New Macro menu command to open the Record Macro dialog box.
14. Enter Twelve_Months as the macro name in the Macro Name text box.
15. Click the Shortcut Key text box and then type an uppercase M so that the
Shortcut key appears as Ctrl+M.
16. If it’s not already selected, select Personal Macro Workbook on the Store Macro
In option’s drop-down list.
17. Select the Description text box and then insert the following additional informa-
tion before the stock Macro recorded followed by the current date and by fol-
lowed by your name:
Enters the twelve months of the year from Jan to Dec in bold italic -
18. Select OK to close the Record Macro dialog box and then click the Relative
Reference button in the Stop Recording toolbar if necessary.
Make sure that the background of the Relative Reference button is highlighted
and not white before proceeding to step 19.