Axis.HasMajorGridlines property (Excel)
True if the axis has major gridlines. Only axes in the primary axis group can have gridlines. Read/write Boolean.
Syntax
expression.HasMajorGridlines
expression A variable that represents an Axis object.
Example
This example sets the color of the major gridlines for the value axis on Chart1.
With Charts("Chart1").Axes(xlValue)
If .HasMajorGridlines Then
.MajorGridlines.Border.ColorIndex = 3 'set color to red
End If
End With
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.