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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,215,463
Messages
6,124,965
Members
449,201
Latest member
Jamil ahmed

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