In a macro I'm writing I'm trying to locate a data point with a particular label on a Stacked Column chart and change its interior color. Since the point can potentially be in any position, I can't use a static Index. Any advice is appreciated.
With Worksheets(1).ChartObjects(1).Chart
For i = 1 To .SeriesCollection(1).Points.Count
With .SeriesCollection(1).Points(i)
If .HasDataLabel Then
If .DataLabel.Text = "Hello" Then
.DataLabel.Interior.ColorIndex = 3
End If
End If
End With
Next i
End With
This code looks for a label named "Hello" (case-sensitive) and changes its interior color to red.
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.