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
|
'------supprime graphes-------------
On Error Resume Next
Sheets("Feuil2").Select
ActiveSheet.ChartObjects.Delete
'-----installe un compeur de colonnes
Sheets("Feuil1").Select
n = Range("B1", Range("B1").End(xlToRight)).Count
For u = 1 To n - 1
'----------------prépare le graphe-------------
With Ws
Set Plage = Union(Range(Cells(1, 1), Cells(6, 2)), Range(Cells(1, u + 2), Cells(6, u + 2)))
End With
Set graphe = Worksheets("Feuil2").ChartObjects.Add(300 + Decalage, 1 + Decalage, 400, 220)
'décale à gauche 'décale vers le bas
With graphe.Chart
.ChartType = xlColumnClustered
.HasTitle = True
.ChartTitle.Text = "test"
.ChartArea.Interior.ColorIndex = 34
.PlotArea.Interior.ColorIndex = 8
.PlotArea.Width = 500 '----------------------largeur graphe
.PlotArea.Height = 500 '--------------------hauteur graphe
With ActiveChart
.SetElement (msoElementChartTitleAboveChart)
.SetElement (msoElementLegendBottom)
.ChartTitle.Text = "test"
.Axes(xlValue).MaximumScale = 1
.Axes(xlValue).MaximumScale = 1.2
.Axes(xlValue).MajorUnit = 0.2
End With
.SeriesCollection.Add Plage, xlColumns, True, True
End With
Decalage = Decalage + 30 '----------------modifie l'écart entre graphes
Next
End Sub |
Partager