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
| Sub Test()
Dim Grf As ChartObject
Dim Sh As Worksheet
Dim i As Integer
Dim Points As Points
i = 1
i = i + 1
Set Sh = Sheets("Données")
'EDIT On supprime le graphique nommé Toto de la feuille Données
For Each Grf In Sh.ChartObjects
If Grf.Name = "Toto" Then
Grf.Delete
Exit For
End If
Next Grf
'On crée notre graphique
Set Grf = Sh.ChartObjects.Add(300, 50, 500, 300)
Grf.Name = "Toto"
With Grf.Chart
.ChartType = xlLineMarkers
.SeriesCollection.NewSeries
With .SeriesCollection(1)
If Range("C2") = "1" Then
.MarkerBackgroundColor = RGB(200, 250, 250)
.MarkerForegroundColor = RGB(200, 250, 250)
Else
End If
.Values = Sh.Range("B2:B14")
End With
End With
Set Grf = Nothing
Set Sh = Nothing
End Sub |
Partager