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
| Sub Graphique ()
Set Rg_chartX = Worksheets("Pivot2").Range("$C$1:$" & Rg_column & "$1")
ActiveChart.FullSeriesCollection(1).XValues = Rg_chartX
Set Rg_chart = Worksheets("Pivot2").Range("$C$2:$" & Rg_column & "$2")
ActiveChart.FullSeriesCollection(1).Values = Rg_chart
Set Rg_chart = Worksheets("Pivot2").Range("$C$3:$" & Rg_column & "$3")
ActiveChart.FullSeriesCollection(2).Values = Rg_chart
w = 0
For w = 0 To k - 2
Set Rg_chart = Worksheets("Pivot2").Range("$C$4:$" & Rg_column & "$4").Offset(w, 0)
'ActiveChart.FullSeriesCollection(3).Values = Rg_chart
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection(3 + w).Name = Worksheets("Pivot2").Range("$C$4").Offset(w, -1)
ActiveChart.FullSeriesCollection(3 + w).Values = Rg_chart
ActiveChart.FullSeriesCollection(3 + w).AxisGroup = 2
ActiveChart.FullSeriesCollection(3 + w).ChartType = xlXYScatter
ActiveChart.FullSeriesCollection(3 + w).XValues = Rg_chartX
Application.Wait (Now + TimeValue("00:00:01"))
DoEvents
'Worksheets("Pivot2").ChartObjects("Graphique 3").Chart.Refresh
Next
'configure chart
Worksheets("Pivot2").ChartObjects("Graphique 3").Chart.Axes(xlValue, xlPrimary).MaximumScale = Worksheets("Pivot2").Range("A2")
Worksheets("Pivot2").ChartObjects("Graphique 3").Chart.Axes(xlValue, xlSecondary).MaximumScale = Worksheets("Pivot2").Range("A2")
Worksheets("Pivot2").ChartObjects("Graphique 3").Chart.Axes(xlValue, xlPrimary).MinimumScale = Worksheets("Pivot2").Range("A4")
Worksheets("Pivot2").ChartObjects("Graphique 3").Chart.Axes(xlValue, xlSecondary).MinimumScale = Worksheets("Pivot2").Range("A4")
Worksheets("Pivot2").ChartObjects("Graphique 3").Chart.Axes(xlValue, xlSecondary).TickLabels.NumberFormat = "#.##0,000"
Worksheets("Pivot2").ChartObjects("Graphique 3").Chart.Refresh
End Sub |
Partager