Name

axis.HasMajorGridlines [= setting]

Synopsis

True displays gridlines; False hides them. The following code displays major gridlines on a 3-D chart:

Sub SetGridlinesOn(  )
    Dim chrt As Chart
    Set chrt = ActiveChart
    chrt.ChartType = xl3DArea
    chrt.Axes(xlCategory, xlPrimary).HasMajorGridlines = True
    chrt.Axes(xlValue, xlPrimary).HasMajorGridlines = True
    chrt.Axes(xlSeries, xlPrimary).HasMajorGridlines = True
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.