Page 316 - Excel Workbook for Dummies
P. 316
33_798452 ch23.qxp 3/13/06 7:51 PM Page 299
Chapter 23: Using the Visual Basic Editor 299
The last step is to the value, “Mind Over Media,” in the ActiveCell.FormulaR1C1
property with the CompanyName variable (whose value is determined by what-
ever is input into the Company Name input dialog box), thus effectively replacing
this constant in the macro with the means for making this input truly interactive.
10. Select “Mind Over Media, Inc.” in line 12 and replace it with the CompanyName
variable (with no quotation marks) so that this line contains
ActiveCell.FormulaR1C1 = CompanyName
11. Carefully check your changes to the code of the Company_Name macro against
those in the first five lines shown in Figure 23-4.
12. When everything checks out, choose the File➪Save PERSONAL.XLS command on
the Visual Basic Editor menu bar.
13. Click the View Microsoft Excel button on the Standard toolbar and then activate
the Book1 workbook.
14. Test out the interactive version of the Company_Name macro by pressing Ctrl+
Shift+C.
A Spreadsheet Title dialog box should appear, prompting you for the name of the
spreadsheet.
15. Replace Mind Over Media, Inc. in the Worksheet Title dialog box with ABC Corp.
Sales and then select the OK button.
The macro now enters ABC Corp. Sales as the worksheet title in 12-point bold
type centered over the merged cell A1:E1 in Sheet1 of Book1.
16. Close the Book1.xls file without saving your changes and then hide the
PERSONAL.XLS workbook by choosing the Window➪Hide menu command.
17. Exit Excel by selecting the Yes button when prompted to save your changes to
the Personal Macro Workbook.
Figure 23-4:
Visual Basic
Editor Code
window
after adding
new com-
mands to
make the
Company_
Name macro
interactive.