I am trying to use VBA to change font colour of data label based on cell value.
The code I use works fine with bar chart. However, It is not working with Waterfall chart. (the colour is not changed but no error pop up at all)
Below is code that I am using. Does anyone have any idea to make it work with Waterfall?
Sub tt()
Dim i As Integer
Dim cht As Chart
Set cht = Sheets("sheet1").ChartObjects("Chart 3").Chart
For i = 1 To 5
On Error Resume Next
If Sheets("Sheet1").Range("B" & i + 1).Value < 0 Then
With cht.FullSeriesCollection(1).Points(i).DataLabel
.Font.Color = RGB(192, 0, 0)
End With
Else
With cht.FullSeriesCollection(1).Points(i).DataLabel
.Font.Color = RGB(0, 176, 80)
End With
End If
Next i
End Sub