Units Related Properties

The Axis object has several properties related to setting units and the scale factor on the axis.

MajorUnit andMinorUnit

Returns or sets (as a Double) the major units or minor units for the specified axis. Setting this property sets the corresponding MajorUnitlsAuto or MinorUnitslsAuto property to


MajorUnitlsAuto andMinorUnitlsAuto

Calculates the major units or minor units for the axis if True. These properties are read/write Boolean.

MajorUnitScale andMinorScaleUnit

Returns or sets the major unit scale value or minor unit scale value for the category axis when the CategoryType property is set to xlTimeScale. It can be one of the following XlTimeUnit constants:

Enum XlTimeUnit xlDays = 0 xlMonths = 1 xlYears = 2 End Enum

MaximumScale and MinimumScale

Returns or sets the maximum or minimum value on the axis as a Double.

MaximumScaleIsAuto andMinimumScaleIsAuto

Calculates the maximum value or minimum value for the axis if True . This property is read/write Boolean.


Returns or sets the value axis scale type; this property applies only to value axes. It can be one of the following XlScaleType constants:

Enum XlScaleType xlScaleLogarithmic = -4133 'Common logarithm xlScaleLinear = -4132 End Enum

To illustrate, the following code:

With ActiveChart.Axes(xlValue, xlPrimary)

.MajorUnit = 1 .MaximumScale = 5 End With will cause the axis to appear as on the left in Figure 21-12. On the other hand, the code:

With ActiveChart.Axes(xlValue, xlPrimary) .MajorUnit = 5 .MaximumScale = 3 End With results in the axis shown on the right in Figure 21-12.

0 0

Post a comment