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
| Sub test()
Dim c As Range, Plage As Range, Ligne As Long, Col As Integer, Graph
With Sheets("Feuil1")
Ligne = .Cells(.Rows.Count, 1).End(xlUp).Row
Col = .Cells(1, .Columns.Count).End(xlToLeft).Column
Set Plage = .Cells(1, 1).Resize(Ligne, Col)
Plage.Copy [Feuil2!A1]
End With
With Sheets("Feuil2")
Set Plage = .Cells(1, 1).Resize(Ligne, Col)
For i = Plage.Rows.Count To 1 Step -1
If .Cells(i, 3) - .Cells(i + 1, 3) = 1 And i + 1 <= Plage.Rows.Count Then
Rows(i).Delete
ElseIf i > 1 Then
If .Cells(i, 3) - .Cells(i - 1, 3) = 1 Then
Rows(i).Delete
End If
End If
Next i
Set Graph = .Shapes.AddChart
Graph.Chart.ChartType = xlLine
Graph.Chart.SeriesCollection.NewSeries
Graph.Chart.SeriesCollection(1).Values = "=Feuil2!" & Plage.Columns(8).Address
Graph.Chart.SeriesCollection(1).XValues = "=Feuil2!" & Plage.Columns(1).Address
End With
End Sub |
Partager