I have an xy scatterplot chart with multiple series. I'm trying to write a macro that will add error bars to the series of my choice. I wrote this, but I can't figure out the errors with the code. I would like the error bars to have custom values of 50, so that they cover the width and height of the chart, but the macro recorder won't record those changes and I can't figure out how to enter them in vb. Any help would be greatly appreciated.
Code:
Sub Crosshairs()
Dim i As Long
For i = 36 To 36
With ActiveSheet.ChartObjects("Chart 1").Chart.SeriesCollection(i)
.HasErrorBars = True
End With
With ActiveSheet.ChartObjects("Chart 1").Chart.SeriesCollection(i).ErrorBars
' The following code is where the debugger is getting stuck.
.ErrorBar Direction:=xlY, Include:=xlBoth, _
Type:=xlCustom, Amount:=0
.ErrorBar Direction:=xlX, Include:=xlBoth, _
Type:=xlCustom, Amount:=0
.EndStyle = xlNoCap
.Visible = msoTrue
.DashStyle = msoLineSysDash
End With
Next i
End Sub