Change part of a datalabel in chart

ExcelRules1

New Member
Joined
Dec 6, 2011
Messages
3
Hi everyone,

In my excel application I'm creating a chart with 20 points. Each point has it's own datalabel. I'm trying to partly change the color of the text of the datalabel of a specific point by using VBA. The datalabel contains the text "A10; A11; A12" and I want to change it to "A10; A11; A12": the color of text "A11" changes to red.

To manage this, I use this code (MyChart being a chart):
Code:
With MyChart.SeriesCollection(1).Points(3).DataLabel
    .Characters(6, 3).Font.Color = vbRed
End With

If I run the code, I'll receive an error: "Method Color of Object Font failed" - 2147467259 (80004005). If I put an "On Error Resume Next" around the code, it works fine except that also other point-datalabels are changed.

Can anyone help me with this problem?

I'm using Excel 2007 (SP3).
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,223,244
Messages
6,170,976
Members
452,372
Latest member
Natalie18

We've detected that you are using an adblocker.

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.
Go back
Back
Top