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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
Sub graph_associe(n, nb3)
'
' graph Macro
' Macro enregistrée le 30/01/2012 par ********
'
Dim Axe As Axis
MsgBox n
MsgBox nb3
Charts.Add
With ActiveChart
.ApplyCustomType ChartType:=xlBuiltIn, TypeName:= _
"Courbe - Histo. 2 axes"
.SetSourceData Source:=Sheets("Global").Range("A1")
.SeriesCollection.NewSeries
.SeriesCollection.NewSeries
.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = "=Global!R1C2:R2C13"
.SeriesCollection(1).Values = "=Global!R2C2:R1C10"
.SeriesCollection(1).Name = "=Global!R2C1"
.SeriesCollection(2).XValues = "=Global!R1C2:R2C13"
.SeriesCollection(2).Values = "=" & "Global" & "!R" & (n * 2) & "C2" & ":" & "R" & (n * 2) & "C10"
.SeriesCollection(2).Name = "=Global!R4C14"
.SeriesCollection(3).XValues = "=Global!R1C2:R2C13"
.SeriesCollection(3).Values = "=" & "Global" & "!R" & (n * 2) - 1 & "C13" & ":" & "R" & (n * 2) - 1 & "C13"
.SeriesCollection(3).Name = "=" & "Global" & "!R" & (n * 2) - 1 & "C1"
.Location Where:=xlLocationAsNewSheet
'action sur le titre du grahique
.HasTitle = True
.ChartTitle.Characters.Text = "**************" & Sheets(nb3 - 2).Name
'action sur l'axe des X
Set Axe = .Axes(xlCategory, xlPrimary)
With Axe
.HasTitle = True
.AxisTitle.Text = "*******"
End With
'action sur l'axe des ordonnées à gauche
Set Axe = .Axes(xlValue, xlPrimary)
With Axe
.HasTitle = True
.AxisTitle.Text = "*******"
End With
'action sur l'axe des ordonnées de droite
Set Axe = .Axes(xlValue, xlSecondary)
With Axe
.HasTitle = True
.AxisTitle.Text = "****"
End With
'assignation des séries en fonction des ordonnées
.SeriesCollection(1).AxisGroup = 2
.SeriesCollection(3).AxisGroup = 1
.SeriesCollection(2).AxisGroup = 2
End With
End Sub |
Partager