Sub Sequence()
Dim x$, N, lig&, P As Range, ncol%, i%, j%
Do
x = InputBox("Entrez la dimension des séquences à colorer :", "Séquences", x)
If x = "" Then Exit Sub
N = Int(Val(x))
Loop While N < 1
Application.ScreenUpdating = False
With Feuil1.Range("A1", Feuil1.UsedRange) 'Feuil1=CodeName
For lig = 6 To 50 'limites à adapter
ncol = .Cells(lig, Columns.Count).End(xlToLeft).Column + 1 '1 colonne de plus
If ncol > 4 Then
Set P = .Cells(lig, 4).Resize(, ncol - 3)
P.Interior.ColorIndex = xlNone 'RAZ
For i = 1 To ncol - 4
x = LCase(P(i)) 'texte en minuscules
If x <> "" And x <> LCase(P(i - 1)) Then
For j = i + 1 To ncol - 3
If LCase(P(j)) <> x Then
If j - i = N Then P(i).Resize(, j - i).Interior.ColorIndex = 6 'jaune
Exit For 'jaun
End If
Next j
End If
Next i
End If
Next lig
End With
End Sub