Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Excel In-cell Enhancements | Excel Worksheet Functions | |||
combining multiple columns into one column - enhancements | Excel Worksheet Functions | |||
Pivot Table Enhancements/Fixes in Excel 2003 | Excel Discussion (Misc queries) |