Private Sub Worksheet_Change(ByVal Target As Range)
Dim saisie As Range, r As Range, tablo(), t$, l%, i%, j%, n
Set saisie = [H1:L1] 'plage à adapter
Set r = [F1:G11] 'plage à adapter
If Intersect(Target, Union(r, saisie)) Is Nothing Then Exit Sub
Application.ScreenUpdating = False
r.Interior.Color = [M1].Interior.Color 'RAZ couleur fond
r.Font.ColorIndex = xlAutomatic 'RAZ couleur police
If Application.Count(saisie) = 0 Then Exit Sub
ReDim tablo(1 To saisie.Count)
For Each r In r
If r <> "" Then
For i = 1 To UBound(tablo)
tablo(i) = saisie(i) 'initialisation
Next
t = r.Text
l = Len(r)
For i = 1 To l
If IsNumeric(Mid(t, i, 1)) Then
For j = i To l
If Not IsNumeric(Mid(t, j, 1)) Then Exit For
Next
n = Application.Match(Val(Mid(t, i, j - i)), tablo, 0)
If IsNumeric(n) Then
r.Characters(i, j - i).Font.Color = [O1].Interior.Color 'police rouge
tablo(n) = "" 'chaque valeur ne sert qu'une fois
End If
i = j
End If
Next
If Application.Count(tablo) = 0 Then 'si toutes les valeurs ont été utilisées
r.Interior.Color = [N1].Interior.Color 'fond jaune
End If
End If
Next
End Sub