Private Sub CommandButton1_Click()
'On remplace "Index" par "INDEX"
Cells.Select
With Application.FindFormat.Font
.Subscript = False
.TintAndShade = 0
End With
Selection.Replace What:="index", Replacement:="INDEX", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
'On lance la recherche des paramètre présents dans un tableau mais pas dans l'autre
For i = 1 To 7
For j = 1 To 17
'Dans le tableau 1
If Range("A" & i) <> Range("G" & j) Then
'On efface la couleur de la cellule
Range("A" & i).Interior.ColorIndex = xlColorIndexNone
'On colorie la cellule en rouge
Range("A" & i).Interior.ColorIndex = 3
End If
'Dans le tableau 2
If Range("A" & i) <> Range("G" & j) Then
'On efface la couleur de la cellule
Range("G" & j).Interior.ColorIndex = xlColorIndexNone
'On colorie la cellule en rouge
Range("G" & j).Interior.ColorIndex = 3
End If
Next j
Next i
'Pour les codes bloom égaux, on va rechercher les différences dans les colones suivantes
For k = 1 To 7
For l = 1 To 17
P = Range("A" & k) = Range("G" & l) And Range("B" & k) <> Range("H" & l)
Q = Range("A" & k) = Range("G" & l) And Range("C" & k) <> Range("I" & l)
R = Range("A" & k) = Range("G" & l) And Range("D" & k) <> Range("J" & l)
S = Range("A" & k) = Range("G" & l) And Range("E" & k) <> Range("K" & l)
'Si les codes bloom sont les mêmes mais qu'il y à des différence dans les colones suivante, on colore les cellules en orange
If P Or Q Or R Or S Then
Range("A" & k).Interior.ColorIndex = xlColorIndexNone
Range("A" & k).Interior.ColorIndex = 45
Range("G" & l).Interior.ColorIndex = xlColorIndexNone
Range("G" & l).Interior.ColorIndex = 45
End If
'Dans chaque ligne ou on a colorer le code bloom en orange, on colorie les variations
If P Then
Range("B" & k).Interior.ColorIndex = xlColorIndexNone
Range("B" & k).Interior.ColorIndex = 45
Range("H" & l).Interior.ColorIndex = xlColorIndexNone
Range("H" & l).Interior.ColorIndex = 45
End If
If Q Then
Range("C" & k).Interior.ColorIndex = xlColorIndexNone
Range("C" & k).Interior.ColorIndex = 45
Range("I" & l).Interior.ColorIndex = xlColorIndexNone
Range("I" & l).Interior.ColorIndex = 45
End If
If R Then
Range("D" & k).Interior.ColorIndex = xlColorIndexNone
Range("D" & k).Interior.ColorIndex = 45
Range("J" & l).Interior.ColorIndex = xlColorIndexNone
Range("J" & l).Interior.ColorIndex = 45
End If
If S Then
Range("E" & k).Interior.ColorIndex = xlColorIndexNone
Range("E" & k).Interior.ColorIndex = 45
Range("K" & l).Interior.ColorIndex = xlColorIndexNone
Range("K" & l).Interior.ColorIndex = 45
End If
Next l
Next k
For n = 1 To 7
For m = 1 To 17
T = Range("A" & n) = Range("G" & m) And Range("B" & n) = Range("H" & m) And Range("C" & n) = Range("I" & m) And Range("D" & n) = Range("J" & m) And Range("E" & n) = Range("K" & m)
'Dans le tableau 1
If T Then
'On efface la couleur de la plage de cellule
Range("A" & n, "E" & n).Interior.ColorIndex = xlColorIndexNone
End If
'Dans le tableau 2
If T Then
'On efface la couleur de la plage de cellule
Range("G" & m, "K" & m).Interior.ColorIndex = xlColorIndexNone
End If
Next m
Next n
Range("A1").Select
End Sub