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
| Sub Macro_Creation_Graph(ByVal FeuilleDEST As String, ByVal DROITE As Integer, ByVal HAUT As Integer, ByVal LARGEUR As Integer, ByVal HAUTEUR As Integer, ByVal NomORD As String, ByVal NomABS As String, ByVal NomGRAPH As String, ByVal FeuilleSRC As String, ByVal ColF As Long, ByVal NbSERIE As Integer, ByVal numeroLgDeb As Integer)
With ThisWorkbook.Worksheets(FeuilleDEST)
.Activate
.Shapes.AddChart(xlColumnStacked, DROITE, HAUT, LARGEUR, HAUTEUR).Select
End With
j = numeroLgDeb
With ThisWorkbook.Worksheets(FeuilleSRC)
For i = 1 To NbSERIE
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).Name = .Range(.Cells(j, 1), .Cells(j, 1)).Value
ActiveChart.SeriesCollection(i).Values = .Range(.Cells(j, 4), .Cells(j, ColF))
j = j + 1
If i = NbSERIE Then ActiveChart.SeriesCollection(i).XValues = .Range(.Cells(1, 4), .Cells(1, ColF))
Next i
End With
With ActiveChart
.SetElement (msoElementDataLabelCenter)
.SetElement (msoElementChartTitleAboveChart)
.SetElement (msoElementPrimaryValueAxisTitleVertical)
.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
.ChartTitle.Text = NomGRAPH
.Axes(xlValue, xlPrimary).AxisTitle.Text = NomORD
.Axes(xlCategory, xlPrimary).AxisTitle.Text = NomABS
.Axes(xlCategory, xlPrimary).TickLabels.Orientation = 90
.Legend.Format.TextFrame2.TextRange.Font.Size = 8
.Legend.Height = 128
End With
End Sub |
Partager