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 Graphique()
'
' Graphique Macro
'
' Touche de raccourci du clavier: Ctrl+g
'
ActiveCell.Offset(0, -2).Range("A1:B3").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("$A$9:$B$11")
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SeriesCollection(1).Select
ActiveSheet.ChartObjects("Graphique 4").Activate
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveSheet.ChartObjects("Graphique 4").Activate
ActiveChart.ChartGroups(1).VaryByCategories = True
ActiveSheet.ChartObjects("Graphique 4").Activate
ActiveChart.Axes(xlCategory).Select
Selection.Delete
ActiveSheet.ChartObjects("Graphique 4").Activate
ActiveChart.SetElement (msoElementChartTitleAboveChart)
ActiveSheet.ChartObjects("Graphique 4").Activate
ActiveChart.ChartTitle.Text = "Electricité"
ActiveSheet.ChartObjects("Graphique 4").Activate
ActiveChart.ChartArea.Select
ActiveCell.Offset(6, 0).Range("A1:B3").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("$A$15:$B$17")
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SeriesCollection(1).Select
ActiveSheet.ChartObjects("Graphique 5").Activate
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveSheet.ChartObjects("Graphique 5").Activate
ActiveChart.ChartGroups(1).VaryByCategories = True
ActiveSheet.ChartObjects("Graphique 5").Activate
ActiveChart.Axes(xlCategory).Select
Selection.Delete
ActiveSheet.ChartObjects("Graphique 5").Activate
ActiveChart.SetElement (msoElementChartTitleAboveChart)
ActiveSheet.ChartObjects("Graphique 5").Activate
ActiveSheet.ChartObjects("Graphique 5").Activate
ActiveChart.ChartTitle.Text = "Eau"
ActiveSheet.ChartObjects("Graphique 5").Activate
ActiveChart.ChartArea.Select
ActiveSheet.ChartObjects("Graphique 5").Activate
ActiveWindow.SmallScroll Down:=9
End Sub |
Partager