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
| Sub test()
Sheets("feuil3").Select
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Feuil2").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Dim NbrLignes As Integer
Dim killed As Integer
Dim avancement As Double
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Nblignes = Selection.Rows.Count
killed = 0
For I = 2 To Nblignes
avancement = Round(I / (Nblignes - killed), 2) * 100
Range("A1").Value = avancement
DoEvents
If Range("A1").Offset(I + 1, 0).Value = Range("A1").Offset(I, 0).Value Then
Rows(I + 1 & ":" & I + 1).Select
Selection.Copy
Rows(I & ":" & I).Select
ActiveSheet.Paste
Rows(I + 1 & ":" & I + 1).Select
Selection.Delete
killed = killed + 1
I = I - 1
End If
If I > Nblignes - killed Then Exit For
Next
End Sub |
Partager