Need Code Enhancements

P

patrick molloy

-----Original Message-----
The following code was suggested to place text on a chart
data series line, in addition to the normal data labels:

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

This is all the code I have. Some questions:

1. Should there be "Sub." and "End Sub" lines?
Yes
SUB MySubName()
'''code
End Sub
2. Where should I place the code?
in a standard code module. Press Alt+F11 then from the
menu Insert and Module
3. How do I correct compile error on line two?
what error?
this code:
Set seSales = ActiveSheet.ChartObjects
(1).Chart.SeriesCollection(1)

should all be on one line, but you can add a space then
the underline character....

Set seSales = _
ActiveSheet.ChartObjects1).Chart.SeriesCollection(1)

4. What does each line do?
1 points to the series,2 sets th eboolean that the series
has a label and 3 adds the text for the label
5. What does the code "seSales" mean?
seSales is a variable that should be DIM'd as a Series
eg
DIM seSates As series
6. I have three different lines on a chart on which to
place text. How would I do this?
you need to change the series number to that which you
want
ie
SeriesCollection(1)
to
SeriesCollection(3)


7. Will this code work with multiple charts in one
worksheet?
chage the chart series number to that which you want to
use
 
T

tritan

add a space and another underbar "_" it's still the same
line...

Set UCL = ActiveSheet.ChartObjects _
(Chart13).Chart.SeriesCollection(1) _
UCL.HasDataLabels = True

Tritan
 

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