New to Excel 9 are the display unit-related properties HasDisplayUnitLabel, DisplayUnitLabel, DisplayUnit, and DisplayUnitCustom, and the DisplayUnitLabel object. These properties can be used to display a unit's legend for a chart axis. This is useful when dealing with labels that contain very large numbers. For instance, if a series of labels has the form 1000000, 2000000, 3000000,
and so on, we can create a legend with the word "millions" and then change the labels to 1, 2, 3, .. . .
As an example, the code:
With ActiveChart.Axes(xlValue) .DisplayUnit = xlMillions .HasDisplayUnitLabel = True With .DisplayUnitLabel .Caption = "millions" .Font.Size = 14 End With End With End Sub produces the chart in Figure 21-11. Note that the value axis is labeled with millions as the legend indicates.
Was this article helpful?