I have a chart on excel with a curve. The curve represents the price of a stock depending of the time (so basically I've a column A full of dates and Column B full of prices and a chart).
Now for each point in the chart there is a datalabel text as followed
Charts("CHART").SeriesCollection(1).Points(Numpoint).DataLabel.Text = numcomptagesetup & vbCrLf & numcomptagecountdown
"numpoint" is a variable that goes from point 1 to the last one. "numcomptagesetup" and "numcomptagecountdown" are values that goes from 1 to 6 for "numcomptagesetup" and from 1 to 15 for "numcomptagecountdown".
The code above is writing "numcomptagesetup" then jumping two lines then writing "numcomptagecountdown"
What I need is, depending on 2 signals, to change the color of "numcomptagesetup" in green or red and the color of "numcomptagecountdown" in green and red too. So in some cases, I'll need to have two different colors in the same datalabeltext.
I've written this loop and it works at least at the beginning (step by step method) then everything change and the colors aren't at the good place (red instead of green or the contrary) ... Really strange By default, all the points are green, then i change the color of the point to red when I want :
For numpoint=1 to 100
With Charts("CHART").SeriesCollection(1).Points(Numpoint)
.HasDataLabel = True
.DataLabel.Text = numcomptagesetup & vbCrLf & numcomptagecountdown
.DataLabel.Font.Size = 6
.DataLabel.Font.Color = vbRed
.MarkerSize = 5
End With
If Signal = 2 Then Charts("CHART").SeriesCollection(1).DataLabels.Select
With Charts("CHART").SeriesCollection(1).Points(Numpoint).DataLabel.Format.TextFrame2.TextRange.Characters(1, 3).Font.Fill
.Visible = msoTrue
.ForeColor
.RGB = RGB(0, 176, 80) .Solid
End With
End If
If Signal2 = 2 Then
Charts("CHART").SeriesCollection(1).DataLabels.Select
With Charts("CHART").SeriesCollection(1).Points(Numpoint).DataLabel.Format.TextFrame2.TextRange.Characters(4, 1).Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 176, 80)
.Solid
End With
End If
I hope you understand my problem ! If not you can ask, i'll answer as quickly as I can
Thank you!!