Ich hab folgendes Makro, welches in jedem sheet für i, im chart 8 die beiden Datenreihen 4 und 5 in Linienformat umändern soll. Das Makro läuft für h =4 einwandfrei, aber für h=5 kommt dann die Meldund Select-Methode konnte nicht ausgeführt werden.
Woran könnte das liegen? Die Meldung kommt auch nicht bei allen sheets
Sub Makro11()
Dim i As Variant
Dim g As Variant
Dim h As Variant
Dim Farbe As Variant
For i = 36 To 46
ActiveWorkbook.Worksheets(i).Select
For g = 8 To 8
ActiveSheet.ChartObjects(g).Activate
ActiveChart.ChartArea.Select
With Selection.Border
.Weight = 1
.LineStyle = -1
End With
Selection.Interior.ColorIndex = 2
For h = 1 To 5
If h = 4 Or h = 5 Then
Select Case h
Case 4
Farbe = "57"
Case 5
Farbe = "38"
End Select
ActiveChart.SeriesCollection(h).Select
ActiveChart.SeriesCollection(h).AxisGroup = 2
ActiveChart.SeriesCollection(h).ChartType = xlLine
ActiveChart.SeriesCollection(h).Select
With Selection.Border
.ColorIndex = Farbe
.Weight = xlMedium
.LineStyle = xlContinuous
End With
End If
Next
Next
Next
End Sub
Gruß Martin