enter image description hereI have the below code that is causing this issue:
Sub ProcessSeries(i As Integer, j As Double)
With Worksheets("Sheet 1").ChartObjects("Chart").Chart _
.SeriesCollection("Series" & i).Format.Line.ForeColor
If j < -2 Then
.RGB = RGB(255, 0, 0) ' for values up to -2
ElseIf j < -1 Then
.RGB = RGB(150, 0, 0) ' for values from -2 to -1
ElseIf j < 0 Then
.RGB = RGB(100, 0, 0) ' for values from -1 to 0
ElseIf j = 0 Then
.RGB = RGB(255, 255, 255) ' for value of 0
ElseIf j < 1 Then
.RGB = RGB(0, 100, 0) ' for values from 0 to 1
ElseIf j <= 2 Then
.RGB = RGB(0, 150, 0) ' for values from 1 to 2
Else
.RGB = RGB(0, 255, 0) ' for values above 2
End If
End With
End Sub
Sheet 1’s name is “Sheet 1”> referring to it as Sheet1 seems to not work
Erorr seen below
New contributor
user26829351 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.