Voici le bout de code censé faire le tri par semestre sur les TCD. Il ne marche pas s'il manque au moins un mois dans un semestre...
Public Sub Tri_6mois_dans_TCD(ByRef m1, m2, m3, m4, m5, m6)
x = 0
Do While Cells(4, x + 1) <> ""
x = x + 1
Loop
m1 = 0
m2 = 0
m3 = 0
m4 = 0
m5 = 0
m6 = 0
For y = x To 1 Step -1
If Cells(4, y).Value = "septembre" Then
m1 = y
ElseIf Cells(4, y).Value = "octobre" Then
m2 = y
ElseIf Cells(4, y).Value = "novembre" Then
m3 = y
ElseIf Cells(4, y).Value = "décembre" Then
m4 = y
ElseIf Cells(4, y).Value = "janvier" Then
m5 = y
ElseIf Cells(4, y).Value = "février" Then
m6 = y
End If
Next y
End Sub
Public Sub Tri_12mois_dans_TCD(ByRef x, y, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12)
x = 0
Do While Cells(4, x + 1) <> ""
x = x + 1
Loop
For y = x To 1 Step -1
If Cells(4, y).Value = "septembre" Then
m1 = y
ElseIf Cells(4, y).Value = "octobre" Then
m2 = y
ElseIf Cells(4, y).Value = "novembre" Then
m3 = y
ElseIf Cells(4, y).Value = "décembre" Then
m4 = y
ElseIf Cells(4, y).Value = "janvier" Then
m5 = y
ElseIf Cells(4, y).Value = "février" Then
m6 = y
ElseIf Cells(4, y).Value = "mars" Then
m7 = y
ElseIf Cells(4, y).Value = "avril" Then
m8 = y
ElseIf Cells(4, y).Value = "mai" Then
m9 = y
ElseIf Cells(4, y).Value = "juin" Then
m10 = y
ElseIf Cells(4, y).Value = "juillet" Then
m11 = y
ElseIf Cells(4, y).Value = "août" Then
m12 = y
End If
Next y
End sub