Code Text Into Chart Lines?

P

Phil Hageman

I have 39 charts in a workbook, where data value changes
cause movement of the lines on the charts. I use text
boxes to identify some of the data lines on the charts.
But as data values change, the text boxes stay in place
while the lines move - requiring manual repositioning of
the text box. This is out of control. How can I attach
text to a data line (coding?) such that it moves with the
line?

Thanks, Phil
 
J

John Green

Phil,

Attach data labels to your chart points.

If you want to use any text, it is quite tricky to do this manually. Using code you can do something like the following:

Set seSales = ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1)
seSales.HasDataLabels = True
seSales.Points(2).DataLabel.Text = "Oranges"
 
P

Phil Hageman

John, Thanks for your response. I want to leave data
labels alone - they show a plotted value, say 100, 200,
etc. I would like to somehow attach text to the line that
says "Oranges". Another line could represent "Apples" etc.

Phil
-----Original Message-----
Phil,

Attach data labels to your chart points.

If you want to use any text, it is quite tricky to do
this manually. Using code you can do something like the
following:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top