Sub quegraph()
Dim x, y As Integer
x = 13
y = 13
Workbooks("cp_horaire.xlsm").Worksheets("cp_horaire").Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range(Cells(x, y), Cells(1, 1))
ActiveChart.ChartType = xlLineMarkers
ActiveChart.PlotBy = xlColumns
ActiveSheet.ChartObjects(1).Name = "Position_Evolution"
ActiveChart.Axes(xlValue).MinimumScale = 0
ActiveChart.Axes(xlValue).MaximumScale = y
ActiveChart.Axes(xlValue).Delete
ActiveChart.Axes(xlValue).MajorGridlines.Delete
ActiveChart.Axes(xlValue).HasMinorGridlines = True
ActiveChart.Axes(xlValue).MinorUnit = 10
ActiveChart.Axes(xlValue).MinorGridlines.Border.Color = RGB(255, 0, 0)
ActiveSheet.ChartObjects("Position_Evolution").Activate
Selection.Width = 746
Selection.Height = 522
ActiveChart.PlotArea.Height = 510
ActiveChart.PlotArea.Top = 5
ActiveChart.PlotArea.Width = 700
ActiveChart.PlotArea.Left = 10
'on affiche l'échelle de l'axe vertical
ActiveChart.SetElement (msoElementPrimaryValueAxisShow)
'on inverse le sens de l'axe vertical
ActiveChart.Axes(xlValue).ReversePlotOrder = True
'on affiche les étiquettes de données, puis on supprime toutes sauf la dernière
ActiveChart.ApplyDataLabels
'police des étiquettes abscisses et des ordonnées
ActiveChart.Axes(xlCategory).TickLabels.Font.Size = 8
ActiveChart.Axes(xlValue).TickLabels.Font.Color = RGB(255, 0, 0)
'suppression trait axe ordonnées
ActiveChart.Axes(xlValue).Border.LineStyle = xlNone
'couleur de fond du graphique
ActiveChart.PlotArea.Interior.Color = RGB(230, 230, 230)
ActiveChart.ChartArea.Interior.Color = RGB(230, 230, 230)
For i = 1 To (y - 1)
ActiveChart.SeriesCollection(i).DataLabels.ShowValue = False
ActiveChart.SeriesCollection(i).DataLabels.ShowSeriesName = True
ActiveChart.SeriesCollection(i).DataLabels.Orientation = 0
'taille des marqueurs
ActiveChart.SeriesCollection(i).MarkerSize = 3
For n = 2 To (x - 1)
ActiveChart.SeriesCollection(i).DataLabels(n).Delete
'on place les étiquettes de données à gauche du point
ActiveChart.SetElement (msoElementDataLabelLeft)
'on masque la légende
ActiveChart.SetElement (msoElementLegendNone)
Next n
Next i
End Sub
ActiveChart.SetSourceData Source:=Range(Cells(x, y), Cells(1, 1))et qu'il te faut donc travailler sur la plage elle-même
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionJ'ai déjà travaillé sur ça, puisqu'à la base l'ordre (logique) était (Cells(1, 1), Cells(x, y))J'y vois en ce qui me concernhe toujours la même plage que le range Range(Cells(x, y), Cells(1, 1)) !