Good morning,
I have a big problem. I have a scatter plot and I would like to put label colors based on a column where I have 4 criteria "Act", "Maintain", "Monitor" and "Asset. Labels should be green if it's "Trump", red if it's "Act" etc. I tried a first code but since I have 200 criteria, I have to repeat it 4 times, which is long.
I also tried the code below, but so far I don't have the right format.
Can you help me please.
I have a big problem. I have a scatter plot and I would like to put label colors based on a column where I have 4 criteria "Act", "Maintain", "Monitor" and "Asset. Labels should be green if it's "Trump", red if it's "Act" etc. I tried a first code but since I have 200 criteria, I have to repeat it 4 times, which is long.
I also tried the code below, but so far I don't have the right format.
VBA Code:
Sub Etiquette_13()
Dim i As Integer
Dim j As Integer
Dim Chart As ChartObject
Set Chart = ActiveSheet.ChartObjects("TRO")
For i = 1 To Chart.Chart.SeriesCollection.Count
For j = 1 To Chart.Chart.SeriesCollection(i).Points.Count
Dim pointValue As String
pointValue = Range("F" & j).Value
If pointValue = "Atout" Then
Chart.Chart.SeriesCollection(i).Points(j).DataLabel.Format.Fill.ForeColor.RGB = RGB(0, 176, 80)
ElseIf pointValue = "Maintenir" Then
Chart.Chart.SeriesCollection(i).Points(j).DataLabel.Format.Fill.ForeColor.RGB = RGB(146, 208, 80)
ElseIf pointValue = "Surveiller" Then
Chart.Chart.SeriesCollection(i).Points(j).DataLabel.Format.Fill.ForeColor.RGB = msoThemeColorAccent2
ElseIf pointValue = "Agir" Then
Chart.Chart.SeriesCollection(i).Points(j).DataLabel.Format.Fill.ForeColor.RGB = RGB(255, 0, 0)
End If
Next j
Next i
End Sub
Can you help me please.