Class Axes (Excel VBA)

A collection of all the Axis objects in the specified chart. To use a Axes class variable it first needs to be instantiated, for example


Dim axs as Axes
Set axs = ActiveChart.Axes()

For Each

Here is an example of processing the Axes items in a collection.


Dim axiAxe As Axis
For Each axiAxe In ActiveChart.Axes()
	
Next axiAxe

Count

Returns a Long value that represents the number of objects in the collection.


Dim lngCount As Long
lngCount = ActiveChart.Axes.Count

Item

Returns a single Axis object from an Axes collection.

Item (Type, AxisGroup)


With Charts("chart1").Axes.Item(xlCategory) 
 .HasTitle = True 
 .AxisTitle.Caption = "1994" 
End With

Arguments

The following argument is required

Type (XlAxisType) - The axis type.

Possible return values are xlCategory - Axis displays categories, xlSeriesAxis - Axis displays data series, xlValue - Axis displays values.

Optional arguments

The following argument is optional

AxisGroup (XlAxisGroup) - The axis.

Possible return values are xlPrimary - Primary axis group, xlSecondary - Secondary axis group.