Mein Code:
Dim temp_StartJahr As Integer
Dim temp_EndJahr As Integer
temp_StartJahr = cmdStoerStartJahr - 1994
temp_EndJahr = cmdStoerEndJahr - 1994
Range("A3:C3,A" & temp_StartJahr & ":C" & temp_EndJahr & "").Select
Range("A" + Format(temp_StartJahr)).Activate
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Stoerungsstatistik").Range("A3:C3,A" & temp_StartJahr & ":C" & temp_EndJahr & ""), _
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Stoerungsstatistik"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Relative Schäden"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Anz pro 100km"
End With
ActiveChart.HasLegend = False
ActiveChart.HasDataTable = True
ActiveChart.DataTable.ShowLegendKey = True
ActiveSheet.ChartObjects("Diagramm 1").Activate
ActiveChart.Export "DiagrammSchaeden.gif"
With frmDiagramm.ImgDiagrammSchaeden
.Picture = LoadPicture("DiagrammSchaeden.gif")
.AutoSize = True
End With
frmDiagramm.Show
Kill "DiagrammSchaeden.gif"
Application.ScreenUpdating = True