1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| Dim Grf As ChartObject
Dim Sh As Worksheet
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim c As Integer
c = 1
i = 7
j = 7
k = 7
Set Sh = Sheets("Graphique")
'On supprime tous les graphiques
For Each Grf In Sh.ChartObjects
Grf.Delete
Next Grf
'On crée notre graphique
Set Grf = Sh.ChartObjects.Add(140, 10, 500, 300)
'On test la contenance des cellules des noeuds'
Do While IsEmpty(Cells(i, 18)) <> True
With Grf.Chart
.ChartType = xlLineMarkers
.SeriesCollection.NewSeries
Do While Cells(i, 18) <> Cells(j, 5)
j = j + 1
Loop
Do While Cells(i, 19) <> Cells(k, 5)
k = k + 1
Loop
With .SeriesCollection(c)
.Values = Range(Cells(j, 7), Cells(k, 7))
.XValues = Range(Cells(j, 6), Cells(k, 6))
End With
End With
c = c + 1
i = i + 1
'on réiniialise les compteurs de ligne"
k = 7
j = 7
Loop
End Sub |
Partager