CHAPTER 1 n THE MACRO RECORDER AND CODE MODULES 21
Figure 1-24.Macro-free workbook warning
The file you opened has an extension of .xlsx, which is the default file format for any
new Excel workbook. This format is not macro-enabled and cannot be macro-enabled. To
use macros in Excel 2007, you must choose a macro-enabled format from the list of file types
in the Save As dialog box.
Choose No from this dialog to display the Save As dialog box. In the ???Save as type???
drop-down list, choose Excel Macro-Enabled Workbook (*.xlsm), as shown in Figure 1-25,
and click OK.
Figure 1-25. Selecting a macro-enabled file type (*.xlsm)
Other macro-enabled file types available are listed in Table 1-3.
Table 1-3.Macro-Enabled File Types
File Type Extension
Macro-enabled template *.xltm
Macro-enabled add-in *.xlam
Non-XML Excel binary workbook *.xlsb
Our TotalSales method will create a formula to insert in the first cell in the Totals section
(B8). That formula will be reused in the rest of the cells in the Totals row on the worksheet.
Let??™s determine the R1C1 coordinates of our formula. Once that??™s done, we??™ll assign that
to a variable so we don??™t have to type it multiple times or copy and paste it.
The first cell in the Totals row is cell B8. On the worksheet, put the cursor in cell B8. For
illustrative purposes, arrow key up until the cursor is in B3 (the first cell in the data range for
that column), counting rows as you move. Of course, it??™s much simpler to just subtract the row
numbers (8 ??“ 3 = 5 in this case).
Pages:
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48