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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
| Sub tri()
'case de début a=A et b=2 ici
Dim i, j As Long
dd = 2
i = 2
j = 1
jour: 'marque gosub
i = dd
If Cells(i, 1).Value = "" Then 'si vide on stoppe le programme (correspondrait la derniËre ligne)
GoSub fin
End If
Do While Cells(i, 1).Value = Cells(i + 1, 1).Value 'cherche l'intervalle avec les dates identiques
i = i + 1
Loop
strike: 'marque gosub
jourd = dd 'fixe intervalle date début
jourf = i 'fixe intervalle date fin
i = jourd 'donne le dÈbut du nouvel intervalle
Do While Cells(i, 2).Value = Cells(i + 1, 2).Value And i < jourf 'cherche l'intervalle de ma deuxième colonne ou les valeurs sont identiques
i = i + 1
Loop
echeance: 'marque gosub
striked = jourd 'fixe l'intervalle..
strikef = i
i = striked
'verifie que l'on ne soit pas sur un cas avec une seule ligne de strike
If striked = strikef Then
dd = dd + 1
GoSub strike 8O
'fin de la verif
End If
Do While Cells(i, 3).Value = Cells(i + 1, 3).Value And i < strikef
i = i + 1
Loop
echeanced = striked
echeancef = i
'verifie que l'on ne soit pas sur un cas avec une ligne d'échéance
If echeanced = echeancef And echeancef < strikef Then
striked = echeancef + 1
GoSub echeance
ElseIf echeanced = echeancef And echeancef = strikef Then
jourd = echeancef + 1
GoTo strike
ElseIf echeanced = echeancef And echeancef = jourf Then
dd = echancef + 1
GoSub jour
'fin de la verif
End If
Range(Cells(echeanced, 1), Cells(echeancef - 1, 10)).Delete
If echeancef < strikef Then
striked = echeancef + 1
GoSub echeance
ElseIf echeancef = strikef Then
jourd = echeancef + 1
GoSub strike
ElseIf echeancef = jourf Then
dd = echeancef + 1
GoSub jour
End If
fin:
MsgBox "Tri terminé"
End Sub |
Partager