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 41 42 43 44 45 46
| Sub Macrograph20()
'
' Macrograph20 Macro
'
'
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("Data").Range("J4:J101")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).Name = "='Data'!$J$3"
ActiveChart.SeriesCollection(2).Values = "='Data'!$J$4:$J$101"
ActiveChart.SeriesCollection(1).XValues = "='Data'!$B$4:$B$101"
ActiveChart.ClearToMatchStyle
ActiveChart.ChartStyle = 43
ActiveChart.ClearToMatchStyle
ActiveChart.Axes(xlCategory).Select
ActiveSheet.ChartObjects("Graphique 1").Activate
ActiveChart.SeriesCollection(1).Select
ActiveSheet.ChartObjects("Graphique 1").Activate
ActiveChart.SeriesCollection(1).Points(60).Select
ActiveChart.SeriesCollection(1).Points(60).Interior.Color = RGB(127, 255, 0)
ActiveSheet.ChartObjects("Graphique 1").Activate
ActiveChart.SeriesCollection(1).Points(63).Select
ActiveChart.SeriesCollection(1).Points(63).Interior.Color = RGB(0, 250, 154)
ActiveSheet.ChartObjects("Graphique 1").Activate
ActiveChart.SeriesCollection(1).Points(98).Select
ActiveChart.SeriesCollection(1).Points(98).Interior.Color = RGB(237, 0, 0)
ActiveChart.Axes(xlCategory).TickLabels.Font.Size = 8
ActiveChart.Axes(xlValue).TickLabels.Font.Size = 8
ActiveChart.SeriesCollection(2).Select
Selection.Delete
ActiveChart.SetElement (msoElementChartTitleAboveChart)
ActiveSheet.ChartObjects("Graphique 1").Activate
ActiveChart.ChartTitle.Text = "Population agée de moins de 20 ans"
ActiveSheet.ChartObjects("Graphique 1").Activate
ActiveChart.ChartArea.Select
With ActiveSheet.Shapes(1)
.ScaleWidth 1.88, msoFalse, msoScaleFromBottomRight
.ScaleHeight 1.49, msoFalse, msoScaleFromBottomRight
.ScaleWidth 1.82, msoFalse, msoScaleFromTopLeft
.ScaleHeight 1.26, msoFalse, msoScaleFromTopLeft
End With
ActiveChart.SetElement (msoElementLegendNone)
ActiveChart.SetElement (msoElementPrimaryValueGridLinesMinorMajor)
End Sub |
Partager