エクセルVBAで困っています。以下のコードを実行しようとすると; それは言います:
Error 1004:Unable to get the name property of the series class!
このエラーは、次のコード行で発生します: (製品は以前に文字列 Zyvox などとして定義されていました)
If namec.Name = product Then
私は何をすべきか?私も他のことを試しました
ActiveChart.SeriesCollection(p).name = product
しかし、役に立たない!助けてください!
Public Sub chartBlue()
Dim i As Integer, j As Integer, p As Integer, namec As Series
For i = 4 To Sheets.Count
Sheets(i).Activate
For j = 1 To Sheets(i).ChartObjects.Count
Sheets(i).ChartObjects(j).Activate
ActiveChart.ChartArea.Select
For p = 1 To ActiveChart.SeriesCollection.Count
Set namec = ActiveChart.SeriesCollection(p)
If namec.Name = product Then
namec.Border.ColorIndex = 5
End If
Next p
Next j
' Windows(Reportname).Activate
Sheets(i).Range("A1").Activate
Next i
End Sub