Excel – Change the Point Color in chart excel VBA

chartsexcelvba

I have this chart in which if any point in graphs exceeds specific limit then its color should change.

enter image description here

can anyone suggest me how to get the chart in VBA and then apply this kind of condition e.g i want to change the color of highest point in the above graph . Any help would be highly appreciated.

Best Answer

Using: ActiveWorkbook.Sheets("Sheet1").ChartObjects("Chart1").Chart.SeriesCollection(1)

Color of each point is .Points(PointNumber).Interior.Color

The number of points you have to cycle though is .Points.Count

The value of each point is .Points(PointNumber).Value

colors of the markers themselves (Applies only to line, scatter, and radar charts):

.Points(PointNumber).MarkerBackgroundColor = RGB(0,255,0)    ' green
.Points(PointNumber).MarkerForegroundColor = RGB(255,0,0)    ' red
.Points(PointNumber).MarkerStyle = xlMarkerStyleCircle ' change the shape