Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Need Code Enhancements


-----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


The problem: I use text boxes and callouts for

notations;

however, when the series lines change the boxes/callouts
must be manually moved on the charts. With 30+ charts,
this situation is out of control. I would like to 1.)

add
text to a line, and 2.) have the text move with the line
when the line (data values) change.

Thanks, Phil

.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Need Code Enhancements

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

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

Tritan
-----Original Message-----
Patrick, Thanks for your time on this problem.

This is an area (not stacked) chart (named Chart13) with
three ranges; with another line series plotting over the
area chart. I have two ranges needing labels: UCL and
LCL - they are series in the area portion of the chart.

Module1 holds this code, along with another Sub code
(which is working okay). This text_label() code is not
working - no labels on the lines.

I do not know what "SeriesCollection(1) means - should I
be changing it to something concerning the

graph/worksheet?

The code:

Sub Text_Label()

Dim UCL As Series
Dim LCL As Series

Set UCL = ActiveSheet.ChartObjects _
(Chart13).Chart.SeriesCollection(1)
UCL.HasDataLabels = True
UCL.Points(2).DataLabel.Text = "UCL"

Set LCL = ActiveSheet.ChartObjects _
(Chart13).Chart.SeriesCollection(1)
LCL.HasDataLabels = True
LCL.Points(2).DataLabel.Text = "LCL"

End Sub

What else do I need to do here?

-----Original Message-----

-----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.SeriesCollectio n(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


The problem: I use text boxes and callouts for

notations;

however, when the series lines change the

boxes/callouts
must be manually moved on the charts. With 30+ charts,
this situation is out of control. I would like to 1.)

add
text to a line, and 2.) have the text move with the

line
when the line (data values) change.

Thanks, Phil

.

.

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Excel In-cell Enhancements silverliningboy Excel Worksheet Functions 4 May 15th 06 08:58 PM
combining multiple columns into one column - enhancements markx Excel Worksheet Functions 0 February 16th 06 04:12 PM
Pivot Table Enhancements/Fixes in Excel 2003 aanyc Excel Discussion (Misc queries) 1 June 20th 05 09:23 PM
Need Code Enhancements Debra Dalgleish[_2_] Excel Programming 1 July 17th 03 03:39 PM


All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"