Sub
Diagramme_erstellen()
Rows(
"14:14"
).
Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range(
"M2"
).
Select
ActiveCell.FormulaR1C1 =
"=AVERAGE(R2C9:R13C9)"
Range(
"M2"
).
Select
Selection.AutoFill Destination:=Range(
"M2:M13"
), Type:=xlFillDefault
Range(
"M2:M13"
).
Select
Range(
"N2"
).
Select
ActiveCell.FormulaR1C1 =
"=RC[-5]/RC[-1]"
Range(
"N2"
).
Select
Selection.AutoFill Destination:=Range(
"N2:N13"
), Type:=xlFillDefault
Range(
"N2:N13"
).
Select
Range(
"O2"
).
Select
ActiveCell.FormulaR1C1 =
"=STDEVA(R2C9:R13C9)"
Range(
"O2"
).
Select
Selection.AutoFill Destination:=Range(
"O2:O14"
), Type:=xlFillDefault
Range(
"O2:O14"
).
Select
Range(
"P14"
).
Select
ActiveCell.FormulaR1C1 =
"=RC[-1]/R[-1]C[-3]"
Range(
"P15"
).
Select
ActiveWindow.ScrollColumn = 2
Range(
"C2:C13,I2:I13"
).
Select
Range(
"I2"
).Activate
ActiveSheet.Shapes.AddChart.
Select
ActiveChart.ChartType = xlXYScatterLinesNoMarkers
ActiveChart.SetSourceData Source:=Range( _
"Tabelle1!$C$2:$C$13;Tabelle1!$I$2:$I$13"
)
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).Values =
"=Tabelle1!$M$2:$M$13"
ActiveChart.SeriesCollection(2).XValues =
"=Tabelle1!$C$2:$C$13"
ActiveChart.SeriesCollection(2).Name =
"="
"Mittlerer Verbrauch"
""
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(3).Name =
"="
"Folgejahr"
""
ActiveChart.SeriesCollection(3).XValues =
"=Tabelle1!$C$2:$C$13"
ActiveChart.SeriesCollection(3).Values =
"=Tabelle1!$I$15:$I$26"
ActiveSheet.Shapes(
"Diagramm 2"
).IncrementLeft 427.2
ActiveSheet.Shapes(
"Diagramm 2"
).IncrementTop -76.8
End
Sub