Testing the Code

Now that we've got our code rewritten to be much more flexible, let's select a data range and create a formatted chart placed below the last chart on the Sales By Category worksheet.

1. Select the data for the Candy product line (cells A10:C13), as shown in Figure 5-31.

Figure 5-31. Data selected for dynamic charting

2. Run PlaceChartDynamic by going to the Developer ribbon and choosing Code > Macros.

3. The new chart is inserted below the Beverages chart and is aligned to its left side, as shown in Figure 5-32.

Figure 5-32. The Candy chart is properly formatted and inserted below the Beverages chart.
0 0

Post a comment