Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
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) | |||
Need Code Enhancements | Excel Programming |