Gridlines Methods

Name

Returns Parameters

Description

Delete

Variant

Deletes the Gridline object

Select

Variant

Selects the gridlines on the chart

Gridlines Object Example

Sub AddAndFormatGridLines()

Dim oChart As Chart

Dim oGridline As Gridlines

Sub AddAndFormatGridLines()

Dim oChart As Chart

Dim oGridline As Gridlines

'Set the target chart and set up the gridline object

Set oChart = ActiveSheet.ChartObjects("Chart 1").Chart Set oGridline = oChart.Axes(xlValue).MajorGridlines

'Add MajorGridlines oChart.Axes(xlValue).HasMajorGridlines = True

'Format gridlines With oGridline

.Border.Weight = xlMedium .Border.LineStyle = xlContinuous .Border.ColorIndex = 3 End With

End Sub

0 0

Post a comment