ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Coding problem: Runtime 1004 (https://www.excelbanter.com/excel-programming/272571-coding-problem-runtime-1004-a.html)

Phil Hageman

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



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com