Hi guys,
I am yet again puzzled by VBA.
I wrote a script that colors the lines in a chart a specific color based on the model number in the Series Name. I have about 250 models that this macro has to set different criteria for.
BUT it somehow does not want to work on all cases, and sometimes works only selectively.
Here is the script:
Please Help!!
I am yet again puzzled by VBA.
I wrote a script that colors the lines in a chart a specific color based on the model number in the Series Name. I have about 250 models that this macro has to set different criteria for.
BUT it somehow does not want to work on all cases, and sometimes works only selectively.
Here is the script:
Code:
Dim j As Integer
j = ActiveChart.Legend.LegendEntries.Count
For i = 1 To j
With ActiveChart
Select Case .SeriesCollection(i).Name
Case "KDL-32BX300"
With .SeriesCollection(i)
.Border.ColorIndex = 2
.Border.Weight = 1
.Border.LineStyle = xlDashDot
.MarkerStyle = False
.Smooth = False
.Shadow = False
.MarkerBackgroundColorIndex = False
.MarkerForegroundColorIndex = False
End With
Case "KDL-32BX400"
With .Legend.LegendEntries(j).LegendKey
.Border.ColorIndex = 2
.Border.Weight = 2
.Border.LineStyle = xlDashDot
.MarkerStyle = False
.Smooth = False
.Shadow = False
.MarkerBackgroundColorIndex = False
.MarkerForegroundColorIndex = False
End With
Case "KDL-32EX402"
With .Legend.LegendEntries(j).LegendKey
.Border.ColorIndex = 2
.Border.Weight = 2
.Border.LineStyle = xlDashDot
.MarkerStyle = False
.Smooth = False
.Shadow = False
.MarkerBackgroundColorIndex = False
.MarkerForegroundColorIndex = False
End With
End Select
End With
Next
End With
Please Help!!