View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Phil Hageman Phil Hageman is offline
external usenet poster
 
Posts: 80
Default Coding problem: Runtime 1004

Running Excel 2000
The following code should add labels to a graph series:

Option Explicit
Sub LastPointLabel()
Dim mySrs As Series
Dim nPts As Long
For Each mySrs In ActiveChart.SeriesCollection
With mySrs
nPts = .Points.Count
mySrs.Points(nPts).ApplyDataLabels _
Type:=xlDataLabelsShowValue, _
AutoText:=True, LegendKey:=False
mySrs.Points(nPts).DataLabel.Text = mySrs.Name
End With
Next
End Sub

I keep getting the following error message:
Run-time error: '1004'
ApplyDataLabels method of Point Class failed

The following lines are highlighted:
mySrs.Points...
Type:=xl...
AutoText:=...
with the yellow arrow on the AutoText:=... line.

Can someone help me debug this error message?

Thanks, Phil