Name

axis.MajorGridlines

Synopsis

Returns the Gridlines object of the axis. For example, the following code selects the category axis major gridlines if they exist:

Sub SelectGridlines(  )
    Dim chrt As Chart, gl As Gridlines
    Set chrt = ActiveChart
    chrt.ChartType = xl3DArea
    If chrt.Axes(xlCategory, xlPrimary).HasMajorGridlines Then
       Set gl = chrt.Axes(xlCategory, xlPrimary).MajorGridlines
       gl.Select
    End If
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.