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
|
Sub CreatioDuGraphiqueDesPertes()
Dim ShResults As Worksheet
Dim MonAireDeDonnees As Range
Dim MonGraphique As Chart
Set ShResults = Sheets("Results")
With ShResults
Set MonAireDeDonnees = .Range("K9:L9, K11:L11, K12:L12")
.Shapes.AddChart.Select
Set MonGraphique = ActiveChart
With MonGraphique
.HasTitle = True
.ChartTitle.Characters.Text = "Répartition des pertes électriques "
.ChartType = xlPie
.SetSourceData Source:=MonAireDeDonnees
.SetElement (msoElementDataLabelCenter)
.ApplyDataLabels
.SeriesCollection(1).DataLabels.ShowPercentage = True
.ChartStyle = 38
.ClearToMatchStyle
End With
End With
Set MonAireDeDonnees = Nothing
Set ShResults = Nothing
Set MonGraphique = Nothing
End Sub |