ActiveChart.SeriesCollection.NewSeries -> neue Ser
28.06.2018 12:32:14
Alina
ich habe es hinbekommen, eine Tabelle zu programmieren
Die bezieht sich auf Werte aus drei Zeilen; klappt soweit
Jetzt sollen Werte aus einer weiteren Zeile auch noch beachtet werden (Zeile 209)
Ich dachte das macht man mit ActiveChart.SeriesCollection.NewSeries
Aber wenn ich hier dann ActiveChart.FullSeriesCollection(4). anspreche, heist es objektfehler....
Seht ihr den Fehler:
ProjName = ActiveSheet.Name
'Klappt:
.Range(.Cells(205, 2), .Cells(207, 63)).Select
.Range(.Cells(205, 2), .Cells(207, 63)).Activate
.Shapes.AddChart2(276, xlAreaStacked, .Range("B81").Left + 9.75, .Range("B81").Top + 4.5, .Cells(81, 63).Left - .Cells(81, 2).Left + 2.5, .Range("B106").Top - .Range("B81").Top + 5.5).Select
ActiveChart.Axes(xlValue).Select
ActiveChart.Axes(xlValue).MaximumScale = 1
ActiveWindow.DisplayGridlines = False
ActiveChart.SetElement (msoElementLegendNone)
ActiveChart.SetElement (msoElementChartTitleNone)
ActiveChart.SetElement (msoElementPrimaryCategoryAxisNone)
ActiveSheet.Shapes("Diagramm 4").Fill.Visible = msoFalse
Application.CommandBars("Format Object").Visible = False
ActiveSheet.Shapes("Diagramm 4").Line.Visible = msoFalse
ActiveSheet.ChartObjects("Diagramm 4").Activate
ActiveChart.FullSeriesCollection(1).Select
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
.Transparency = 0.75
.Solid
End With
ActiveChart.FullSeriesCollection(2).Select
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 192, 0)
.Transparency = 0.75
.Solid
End With
ActiveChart.FullSeriesCollection(3).Select
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 176, 80)
.Transparency = 0.75
.Solid
End With
'HIER IST DANN DER FEHLER
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection(4).Name = "='" & ProjName & "'!$B$209'" 'hier noch Änderung
ActiveChart.FullSeriesCollection(4).ChartType = xlLineMarkersStacked
ActiveChart.FullSeriesCollection(4).Select
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.Weight = 1
End With
With Selection.Format.Fill
.Visible = msoFalse
End With
With Selection
.MarkerStyle = 8
.MarkerSize = 6
.ApplyDataLabels
End With
ActiveChart.FullSeriesCollection(4).DataLabels.Select
With Selection
.Position = xlLabelPositionAbove
.ShowRange = True
.ShowValue = False
.Format.TextFrame2.TextRange. _
InsertChartField msoChartFieldRange, "='" & ProjName & "'!$C$208:$BZ$208", 0
End With
End With