SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 192 | Next

Jim DeMarco

"Pro Excel 2007 VBA"

ChartObjects(1).Activate
CHAPTER 5 n CHARTING IN EXCEL 2007 201
The next line of code is where the work is being done:
ActiveChart.PlotBy = xlRows
The ActiveChart.PlotBy property sets or returns a value of the XlRowCol enumeration.
Table 5-3 lists the values of the XlRowCol enumerated items.
Table 5-3. XlRowCol Enumeration
Name Value
xlRows 1
xlColumns 2
Summarizing with Pie Charts
In Chart01.xlsm, select the Sales By Category worksheet. Here you??™ll see a list of product categories
with sales quantities by month, as in Figure 5-9.
Figure 5-9. The Sales By Category worksheet
This data provides us with a great format to display each category in a pie chart to see
how overall sales looked by month for each product line. Before you begin charting data like
this, it??™s a good idea to make sure the data is sorted correctly to make your selections for charting
easier.
CHAPTER 5 n CHARTING IN EXCEL 2007 202
1. Put the cursor anywhere in the data table on the Sales By Category worksheet.
2. On the Data ribbon, choose the Sort command, as shown in Figure 5-10.
Figure 5-10. The Sort command on the Data ribbon
The Sort dialog box appears, as shown in Figure 5-11.
Figure 5-11. The Sort dialog box
In this case, Excel made a guess that we want to sort by the Month column (and we are
going to override this).We want to sort by Category first, and then by Month.
nNote As I was testing this code, I had various results in what Excel decided would be the ???Sort by??? column.


Pages:
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204