Gridlines Object

Description

Represents major gridlines or minor gridlines on a chart axis. Gridlines extend the tick marks on a chart axis to make it easier to see the values associated with the data markers. There is no singular GridLine object; you must turn all gridlines for an axis on or off at once.

Accessors

The MajorGridlines property returns the major gridlines for the axis. The MinorGridlines property returns the minor gridlines. There is no GridLines property or collection; you must access the major and minor gridlines separately.

The following example turns on major gridlines for the category axis on the chart sheet named "Chart1" and then formats the gridlines to be blue dashed lines.


Charts("chart1").Axes(xlCategory).HasMajorGridlines = True
Charts("chart1").Axes(xlCategory).MajorGridlines.Border.Color = _
    RGB(0, 0, 255)
Charts("chart1").Axes(xlCategory).MajorGridlines.Border.LineStyle = _
    xlDash

Properties

Application Property, Border Property, Creator Property, Name Property, Parent Property.

Methods

Delete Method, Select Method.