Wie kann ich den folgenden Code so umschreiben,
dass die Objektvariable "container" nur einmal gesetzt wird?
hG
Rolf
Private Sub NewChart()
Dim container As Chart
Dim containerbok As Workbook
Const strName$ = "NewChart"
Set containerbok = Workbooks.Add(1)
ActiveSheet.Name = strName
Set container = Charts.Add 'einmal Set
With container
.ChartType = xlColumnClustered
.SetSourceData Source:=Worksheets(1).Range("A1")
.Location Where:=xlLocationAsObject, Name:=strName
End With
Set container = ActiveChart 'nochmal Set
With container.ChartArea
.ClearContents
.Border.LineStyle = xlLineStyleNone
.Interior.ColorIndex = xlColorIndexNone
End With
End Sub