HasAxis Property

Microsoft Excel Visual Basic

Show All

HasAxis Property

       

Returns or sets which axes exist on the chart. Read/write Variant.

expression.HasAxis(Index1, Index2)

expression   Required. An expression that returns one of the objects in the Applies To list.

Index1  Optional Variant. The axis type. Series axes apply only to 3-D charts. Can be one of the XlAxisType constants.

XlAxisType can be one of the following XlAxisType constants.
xlCategory
xlValue
xlSeriesAxis

Index2  Optional Variant. The axis group. 3-D charts have only one set of axes. Can be one of the XlAxisGroup constants.

XlAxisGroup can be one of the following XlAxisGroup constants.
xlPrimary
xlSecondary

Remarks

Microsoft Excel may create or delete axes if you change the chart type or the AxisGroup property.

Example

This example turns on the primary value axis for Chart1.

Charts("Chart1").HasAxis(xlValue, xlPrimary) = True