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

That code will replace the existing label with the text "Oranges". If
you want to keep the label, and add the text, you could create a formula
in another cell, to combine the two. For example, if the value is in
cell C2:
="Oranges" & CHAR(10) & C2

Then, Rob Bovey has a free add-in, the XY Chart Labeler, that you can
use to add the labels:

http://www.appspro.com/utilities/Labeler.asp

Install the add-in, and use the Manual Labeler to add the calculated
label to the point.

For your questions,
1. Yes, you'd need a Sub and End Sub
2. Place the code on a regular module
3. Line two should be part of line one, not a separate line
4/5. The code defines a variable (seSales) as a series in chart 1 on the
active sheet. It adds data labels to that series, and changes the label
for point 2 in that series.
6/7. You could use For Each...Next loops to add the labels to each
chart/series, but I'm not sure where your new label text (e.g.
"Oranges") is stored.


Phil Hageman wrote:
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?
2. Where should I place the code?
3. How do I correct compile error on line two?
4. What does each line do?
5. What does the code "seSales" mean?
6. I have three different lines on a chart on which to
place text. How would I do this?
7. Will this code work with multiple charts in one
worksheet?

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



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

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

Debra, 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
work - 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?

Thanks, Phil

-----Original Message-----
That code will replace the existing label with the

text "Oranges". If
you want to keep the label, and add the text, you could

create a formula
in another cell, to combine the two. For example, if the

value is in
cell C2:
="Oranges" & CHAR(10) & C2

Then, Rob Bovey has a free add-in, the XY Chart Labeler,

that you can
use to add the labels:

http://www.appspro.com/utilities/Labeler.asp

Install the add-in, and use the Manual Labeler to add the

calculated
label to the point.

For your questions,
1. Yes, you'd need a Sub and End Sub
2. Place the code on a regular module
3. Line two should be part of line one, not a separate

line
4/5. The code defines a variable (seSales) as a series in

chart 1 on the
active sheet. It adds data labels to that series, and

changes the label
for point 2 in that series.
6/7. You could use For Each...Next loops to add the

labels to each
chart/series, but I'm not sure where your new label text

(e.g.
"Oranges") is stored.


Phil Hageman wrote:
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?
2. Where should I place the code?
3. How do I correct compile error on line two?
4. What does each line do?
5. What does the code "seSales" mean?
6. I have three different lines on a chart on which to
place text. How would I do this?
7. Will this code work with multiple charts in one
worksheet?

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



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

.

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
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
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 03:12 PM
Pivot Table Enhancements/Fixes in Excel 2003 aanyc Excel Discussion (Misc queries) 1 June 20th 05 09:23 PM


All times are GMT +1. The time now is 07:53 PM.

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"