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
| Sub Graphique()
'la variable dim est tiré de la base access
dim ligne as integer
'ajoute un graph
Charts.Add
'Choix du type de graphique
ActiveChart.ChartType = xlLineMarkers
'Récupération des données
ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("F23")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "=Feuil1!R1C1:R" & lignes & "C1"
ActiveChart.SeriesCollection(1).Values = "=Feuil1!R1C2:R8C2"
'Positionnement du graphique selon les postions de bases Excel
ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
With ActiveChart
.HasTitle = True
'construction de la legende
.ChartTitle.Characters.Text = "Remonté reparateur"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "semaine"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "nombres de pannes"
'positionnement du graphique
End With
ActiveSheet.Shapes(1).IncrementLeft -192#
ActiveSheet.Shapes(1).IncrementTop 6.75
'Couleur de la courbe
ActiveChart.SeriesCollection(1).Select
With Selection.Border
.ColorIndex = 5
.Weight = xlMedium
.LineStyle = xlContinuous
End With
With Selection
.MarkerBackgroundColorIndex = xlAutomatic
.MarkerForegroundColorIndex = xlAutomatic
.MarkerStyle = xlNone
.Smooth = False
.MarkerSize = 7
.Shadow = False
End With
ActiveChart.PlotArea.Select
'couleur de fond
With Selection.Interior
.ColorIndex = 2
.PatternColorIndex = 1
.Pattern = xlSolid
End With
'Supression de la legende trop moche et inutil
ActiveChart.Legend.Select
Selection.Delete
End Sub |
Partager