Coding problem: Runtime 1004

P

Phil Hageman

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top