Private Sub Worksheet_Change(ByVal Target As Range)
Dim tablo, i&, x$, n&
Application.ScreenUpdating = False
Application.EnableEvents = False 'désactive les évènements
If FilterMode Then ShowAllData 'si la feuille est filtrée
With UsedRange.Resize(, 3)
If Not Intersect(Target, .Columns(3)) Is Nothing Then Application.Undo: GoTo 1 'annule les modifications en colonne C
tablo = .Value 'matrice, plus rapide
For i = 2 To UBound(tablo)
If IsEmpty(tablo(i, 2)) And Not IsEmpty(tablo(i, 3)) Then tablo(i, 3) = ""
x = CStr(tablo(i, 3))
If x <> "" Then If Not x Like "T" & String(Len(x) - 1, "#") Then tablo(i, 3) = ""
Next
.Value = tablo '1ère restitution
n = Application.CountA(.Columns(3))
For i = 2 To UBound(tablo)
If Not IsEmpty(tablo(i, 2)) And IsEmpty(tablo(i, 3)) Then _
tablo(i, 3) = "T" & n: n = n + 1
Next
.Value = tablo '2ème restitution
End With
1 Application.EnableEvents = True 'réactive les évènements
End Sub