A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Data Label for XY Scatter Plot



 
 
Thread Tools Display Modes
  #1  
Old November 4th, 2008, 12:31 AM posted to microsoft.public.excel.charting
AdmiralAJ
external usenet poster
 
Posts: 15
Default Data Label for XY Scatter Plot

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  
Old November 4th, 2008, 07:05 AM posted to microsoft.public.excel.charting
PBezucha
external usenet poster
 
Posts: 72
Default Data Label for XY Scatter Plot

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  
Old November 4th, 2008, 08:34 AM posted to microsoft.public.excel.charting
AdmiralAJ
external usenet poster
 
Posts: 15
Default Data Label for XY Scatter Plot

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.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:12 PM.


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