Bonjour j'ai 2 tableaux et 2 code couleurs et 3 regles. J'ai expliqué les principes primaires dans la feuille excel ci jointe 😉
Je ne comprend pas pk ce code ne marche pas 🙂
Dans cette ligne
j'ai imcompatibilité de type
Voila mon code entier:
Je ne comprend pas pk ce code ne marche pas 🙂
Dans cette ligne
Code:
'Dans le tableau 1
If Range("H" & i) <> Range("O" & j) Then
j'ai imcompatibilité de type
Voila mon code entier:
Code:
b CommandButtonOption_Click()
'On lance la recherche des paramètre présents dans un tableau mais pas dans l'autre
For i = 4 To 50
For j = 4 To 50
'Dans le tableau 1
If Range("H" & i) <> Range("O" & j) Then
'On efface la couleur de la cellule
Range("H" & i).Interior.ColorIndex = xlColorIndexNone
'On colorie la cellule en rouge
Range("H" & i).Interior.ColorIndex = 3
End If
'Dans le tableau 2
If Range("H" & i) <> Range("O" & j) Then
'On efface la couleur de la cellule
Range("O" & j).Interior.ColorIndex = xlColorIndexNone
'On colorie la cellule en rouge
Range("O" & 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 = 4 To 50
For l = 4 To 50
p = Range("H" & k) = Range("O" & l) And Range("I" & k) <> Range("P" & l)
Q = Range("H" & k) = Range("O" & l) And Range("J" & k) <> Range("Q" & l)
R = Range("H" & k) = Range("O" & l) And Range("K" & k) <> Range("R" & l)
S = Range("H" & k) = Range("O" & l) And Range("L" & k) <> Range("S" & 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("H" & k).Interior.ColorIndex = xlColorIndexNone
Range("H" & k).Interior.ColorIndex = 45
Range("O" & l).Interior.ColorIndex = xlColorIndexNone
Range("O" & 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("I" & k).Interior.ColorIndex = xlColorIndexNone
Range("I" & k).Interior.ColorIndex = 45
Range("P" & l).Interior.ColorIndex = xlColorIndexNone
Range("P" & l).Interior.ColorIndex = 45
End If
If Q Then
Range("J" & k).Interior.ColorIndex = xlColorIndexNone
Range("J" & k).Interior.ColorIndex = 45
Range("Q" & l).Interior.ColorIndex = xlColorIndexNone
Range("Q" & l).Interior.ColorIndex = 45
End If
If R Then
Range("K" & k).Interior.ColorIndex = xlColorIndexNone
Range("K" & k).Interior.ColorIndex = 45
Range("R" & l).Interior.ColorIndex = xlColorIndexNone
Range("R" & l).Interior.ColorIndex = 45
End If
If S Then
Range("L" & k).Interior.ColorIndex = xlColorIndexNone
Range("L" & k).Interior.ColorIndex = 45
Range("S" & l).Interior.ColorIndex = xlColorIndexNone
Range("S" & l).Interior.ColorIndex = 45
End If
Next l
Next k
For n = 4 To 50
For m = 4 To 50
T = Range("H" & n) = Range("O" & m) And Range("I" & n) = Range("P" & m) And Range("J" & n) = Range("Q" & m) And Range("K" & n) = Range("R" & m) And Range("L" & n) = Range("S" & m)
'Dans le tableau 1
If T Then
'On efface la couleur de la plage de cellule
Range("H" & n, "L" & n).Interior.ColorIndex = xlColorIndexNone
End If
'Dans le tableau 2
If T Then
'On efface la couleur de la plage de cellule
Range("O" & m, "S" & m).Interior.ColorIndex = xlColorIndexNone
End If
Next m
Next n
Range("A1").Select
For i = 4 To 50
If Range("P" & i).Value = 0 And Range("Q" & i).Value = 0 And Range("R" & i).Value = 0 And Range("S" & i).Value = 0 Then
Range("O" & i).Interior.ColorIndex = xlColorIndexNone
End If
Next
For m = 4 To 50
If Range("H" & m).Value = "Total général" Then
Range("H" & m).Interior.ColorIndex = xlColorIndexNone
End If
Next
For m = 4 To 50
If Range("H" & m).Value = "" Then
Range("H" & m).Interior.ColorIndex = xlColorIndexNone
End If
Next
End Sub
Pièces jointes
Dernière édition: