Name

axis.AxisTitle

Synopsis

Returns the AxistTitle object for the axis. Check the HasTitle property before using this object, and use the AxisTitle Caption property to change the title as shown by the following code:

Sub ChangeAxisTitle(  )
    Dim chrt As Chart, ax As Axis
    Set chrt = ActiveSheet
    Set ax = chrt.Axes(xlCategory, xlPrimary)
    If ax.HasTitle Then _
      ax.AxisTitle.Caption = "New Caption"
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.