Option Explicit
Sub graph_temperature_mini_maxi()
Dim F1 As Worksheet, F2 As Worksheet
Set F1 = Worksheets(Feuil4.Name)
Set F2 = Worksheets(Feuil6.Name)
Application.ScreenUpdating = False
On Error Resume Next
F2.Shapes("Graphique1").Delete
Charts.Add
With ActiveChart
.ChartType = xlLine
.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = F1.Range("A2", F1.[A2].End(xlDown))
.SeriesCollection(1).Values = F1.Range("G2", F1.[G2].End(xlDown))
.SeriesCollection(1).Name = F1.Range("G1")
.SeriesCollection.NewSeries
.SeriesCollection(2).Values = F1.Range("E2", F1.[E2].End(xlDown))
.SeriesCollection(2).Name = F1.Range("E1")
.Location Where:=xlLocationAsObject, Name:="graph.mini-maxi"
End With
ActiveSheet.ChartObjects("Graphique1").Activate
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlValue).CrossesAt = Worksheets("config").Range("K3").Value
ActiveChart.ChartTitle.Delete
ActiveChart.ChartObjects("Graphique1").Activate
ActiveChart.Axes(xlCategory).TickLabelSpacing = Worksheets("config").Range("K4").Value
ActiveChart.Axes(xlCategory).TickMarkSpacing = Worksheets("config").Range("K5").Value
ActiveChart.ChartArea.Select
ActiveChart.Parent.Name = "Graphique1"
With ActiveSheet.Shapes("Graphique1")
.Left = Worksheets("config").Range("K6").Value
.Top = Worksheets("config").Range("K7").Value
.Width = Worksheets("config").Range("K8").Value
.Height = Worksheets("config").Range("K9").Value
End With
[A1].Select
End Sub