Sub graphique()
Dim objChart As Chart, objRange1 As Range, objRange2 As Range, MaSerie As Series, compteur As Long
Dim i, j, k As Long
Dim ws, gr As Worksheet
Set ws = Sheets("Zone de Contrôle")
Set gr = Sheets("Graphiques")
Set objRange1 = ws.Range(ws.Cells(7, 38), ws.Cells(59, 64))
Set objRange2 = ws.Range(ws.Cells(7, 65), ws.Cells(59, 90))
gr.ChartObjects("Chart 1").Activate
ActiveChart.ChartType = xlLine
Set MaSerie = ActiveChart.SeriesCollection.NewSeries
i = ws.Cells(2, 37).Value
For compteur = 2 To objRange1.Columns.Count
For i = 1 To 3
If ws.Cells(2, 38) = 1 And ws.Cells(4, 38) = 1 Then
ActiveChart.SeriesCollection.Add objRange1, xlColumns, True, True
MaSerie.Values = "=" & objRange1.Columns(compteur).Address(True, True, xlR1C1, True)
MaSerie.XValues = "=" & objRange1.Columns(1).Address(True, True, xlR1C1, True)
If ws.Cells(2, 38) = 1 And ws.Cells(4, 38) = 2 Then
ActiveChart.SeriesCollection.Add objRange2, xlColumns, True, True
MaSerie.Values = "=" & objRange2.Columns(compteur).Address(True, True, xlR1C1, True)
MaSerie.XValues = "=" & objRange2.Columns(1).Address(True, True, xlR1C1, True)
End If
End If
Next i
Next compteur
End Sub