Microsoft Office Tutorials and References
In Depth Information
Applying Data Labels
The TopPosition variable stores the vertical position of the chart and is
modified each time through the loop. The new vertical position is the previous vertical
position plus the height of the ChartObject object. The result is a stack of charts,
neatly aligned with no space in between each.
The JWalk Chart Tools add-in, available on the companion CD-ROM, includes
a utility to resize all charts on the active sheet so that they match the active
chart (see Figure 16-10).
Figure 16-10: Using the Chart Size utility
from the JWalk Chart Tools add-in
Applying Data Labels
As you may know, applying data labels to a chart series has a serious limitation:
Excel does not enable you to specify an arbitrary range for the data label text. With
a fairly simple macro, however, you can overcome this limitation and apply data
labels from any range.
A basic data label macro
Figure 16-11 shows an XY chart. The goal is to label each point with the
corresponding name in column A. The following macro accomplishes this goal.
Sub ApplyDataLabels()
Dim Ser As Series, Pt As Point
Dim Counter As Long
Set Ser = ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1)
Ser.HasDataLabels = True
Counter = 1
Search JabSto ::

Custom Search