Sub Courbes()
Dim I As Long
Dim colonnemax As Long
Cells(13, 3).Select
ActiveCell.Value = datedébut
colonnemax = ActiveCell.Column
Set mafeuille = ThisWorkbook.Worksheets("Evolution du poids")
With mafeuille
Set plage1 = .Range(.Cells(14 * I, 3), .Cells(14 * I, colonnemax))
Set plage2 = .Range(.Cells(13 * I, 3), .Cells(13 * I, colonnemax))
End With
With Sheets("Evolution du poids").ChartObjects.Add(Left:=100, Width:=24 * colonnemax, Top:=100 + 730 * l, Height:=700)
With .Chart.SeriesCollection.NewSeries
.Values = plage1
.XValues = plage2
.Name = "Courbe de mon poids"
End With
.Chart.ChartType = xlLine
.Chart.PlotArea.Interior.ColorIndex = 36
.Chart.ChartArea.Interior.ColorIndex = 35
.Chart.HasTitle = True
.Chart.ChartTitle.Text = "Courbe de mon poids "
.Chart.ChartTitle.Font.Size = 20
.Chart.ChartTitle.Font.Bold = True
.Chart.ChartTitle.Font.Italic = True
.Chart.SeriesCollection(2).HasDataLabels = True
.Chart.SeriesCollection(2).DataLabels.NumberFormat = "#"
.Chart.SeriesCollection(2).DataLabels.Font.ColorIndex = 3
.Chart.SeriesCollection(2).DataLabels.Font.Bold = True
.Chart.SeriesCollection(1).Border.ColorIndex = 51
.Chart.SeriesCollection(2).Border.ColorIndex = 3
.Chart.Legend.Position = xlLegendPositionBottom
.Chart.Legend.Font.Bold = True
.Chart.Legend.Font.Size = 12
With .Chart.Axes(xlCategory)
.TickLabels.NumberFormat = "#"
.HasMinorGridlines = True
.MinorGridlines.Border.ColorIndex = 16
.MinorGridlines.Border.LineStyle = xlDash
.HasMajorGridlines = True
.MajorGridlines.Border.ColorIndex = 36
.HasTitle = True
.AxisTitle.Caption = "Semaines"
.AxisTitle.Font.Size = 16
End With
With .Chart.Axes(xlValue)
.TickLabels.NumberFormat = "#"
.MinimumScale = 0
.MaximumScale = 100
.HasMajorGridlines = True
.MajorGridlines.Border.ColorIndex = 3
.MajorGridlines.Border.LineStyle = xlDash
.HasTitle = True
.AxisTitle.Caption = "Poids"
.AxisTitle.Font.Size = 16
End With
End With
End Sub