Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
I tried using code that John Mansfield had posted a while back with a
modification and its not working right. I get the following error: "run-time error '91'" My data is on a worksheet and the chart is on a chartsheet and I have set the code to run when this chartsheet is activated. To give you a little more background series 1 & 2 of this chart are line graphs and series 3 is the xy scatter graph. I was hoping someone could help me figure out what I'm doing wrong and why I'm getting the error above. Below is the modified code: Sub AttachLabelsToPoints() Dim RngLabels As range Dim Ser As Series Dim i As Long Ser = ActiveChart.SeriesCollection(3) <==== This is where the debugger stops to highlight my code Set RngLabels = ActiveWorkbook.Worksheets(1).range("e10:e17") Ser.HasDataLabels = True For i = 1 To Ser.Points.Count Ser.Points(i).DataLabel.Text = RngLabels(i) Next i End Sub Thanks in advance....AJ |
#2
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
You have simply omitted Set before the definition of your SeriesCollection
object though being certainly aware of it. Regards -- Petr Bezucha "AdmiralAJ" wrote: I tried using code that John Mansfield had posted a while back with a modification and its not working right. I get the following error: "run-time error '91'" My data is on a worksheet and the chart is on a chartsheet and I have set the code to run when this chartsheet is activated. To give you a little more background series 1 & 2 of this chart are line graphs and series 3 is the xy scatter graph. I was hoping someone could help me figure out what I'm doing wrong and why I'm getting the error above. Below is the modified code: Sub AttachLabelsToPoints() Dim RngLabels As range Dim Ser As Series Dim i As Long Ser = ActiveChart.SeriesCollection(3) <==== This is where the debugger stops to highlight my code Set RngLabels = ActiveWorkbook.Worksheets(1).range("e10:e17") Ser.HasDataLabels = True For i = 1 To Ser.Points.Count Ser.Points(i).DataLabel.Text = RngLabels(i) Next i End Sub Thanks in advance....AJ |
#3
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
On Nov 3, 11:05*pm, PBezucha
wrote: You have simply omitted Set before the definition of your SeriesCollection object though being certainly aware of it. Regards -- Petr Bezucha "AdmiralAJ" wrote: I tried using code that John Mansfield had posted a while back with a modification and its not working right. *I get the following error: "run-time error '91'" *My data is on a worksheet and the chart is on a chartsheet and I have set the code to run when this chartsheet is activated. *To give you a little more background series 1 & 2 of this chart are line graphs and series 3 is the xy scatter graph. *I was hoping someone could help me figure out what I'm doing wrong and why I'm getting the error above. *Below is the modified code: Sub AttachLabelsToPoints() * * Dim RngLabels As range * * Dim Ser As Series * * Dim i As Long * * * * Ser = ActiveChart.SeriesCollection(3) *<==== This is where the debugger stops to highlight my code * * * * Set RngLabels = ActiveWorkbook.Worksheets(1).range("e10:e17") * * * * Ser.HasDataLabels = True * * * * For i = 1 To Ser.Points.Count * * * * * * Ser.Points(i).DataLabel.Text = RngLabels(i) * * * * Next i *End Sub Thanks in advance....AJ Thanks! It works now. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
hyperlinking xy scatter plot data label to a cell | Excel Discussion (Misc queries) | |||
How do I label data points in a scatter graph | Charts and Charting in Excel | |||
Label XY scatter plot points by frequency of occurence (no pivot t | Charts and Charting in Excel | |||
Can I copy x-y scatter plot data direct from one plot to another? | Charts and Charting in Excel | |||
scatter plot & label for a data point | Charts and Charting in Excel |