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
| Sub Courbe()
Dim FSGraph As Chart, Graphik As Worksheet, Donnees As Range
Dim PlageX As Range, PlageY As Range, MaSerie As Series, cmpt As Long, k As Integer
For k = 0 To 1
Set Graphik = Worksheets("Graphikgrundlag. techn. Fortsch")
' # Boucle pour transformer les date en texte
For Each PlageX In Graphik.Range(Graphik.Cells(6, 3), Graphik.Cells(6, Graphik.Cells(6, 3).End(xlToRight).Column))
PlageX = "'" & Format(PlageX.Value, "mmm-yy")
Next
With Graphik
Set Donnees = .Range(.Cells(6, 3), .Cells(9 + 3 * k, .Cells(6, 3).End(xlToRight).Column))
End With
Set FSGraph = ThisWorkbook.Charts.Add
FSGraph.ChartArea.Clear
FSGraph.ChartType = xlLineMarkers
Set PlageX = Donnees.Rows(1)
For cmpt = 1 To 3
Set PlageY = PlageX.Offset(cmpt + 3 * k, 0)
Set MaSerie = FSGraph.SeriesCollection.NewSeries
With MaSerie
.Values = PlageY
.XValues = PlageX
.Border.ColorIndex = 13 + cmpt
.MarkerBackgroundColorIndex = 13 + cmpt
.MarkerForegroundColorIndex = 13 + cmpt
End With
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "FS" & k
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Zeit"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "FS(%)"
End With
ActiveChart.HasLegend = True
ActiveChart.Legend.Select
Selection.Position = xlRight
FSGraph.SeriesCollection(cmpt).Name = "=""" & Graphik.Range(Donnees.Cells(cmpt + 1, 0).Address).Value & """"
Next cmpt
FSGraph.SeriesCollection(1).ChartType = xlColumnClustered
FSGraph.SeriesCollection(1).Interior.ColorIndex = 16
FSGraph.SeriesCollection(1).Border.ColorIndex = 16
FSGraph.Location Where:=xlLocationAsObject, Name:="Graph"
' # Boucle pour remettre les dates
For Each PlageX In Graphik.Range(Graphik.Cells(6, 3), Graphik.Cells(6, Graphik.Cells(6, 3).End(xlToRight).Column))
PlageX = Replace(PlageX.Value, "'", "")
Next
Next k
End Sub |
Partager