1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| Sub Communes()
Sheets("mag").Cells.Interior.ColorIndex = xlNone
Dim D1 As Long, D2 As Long, I1 As Long, I2 As Long
Dim T1, T2 'tableaux des colonnes C&E et C&I
D1 = Sheets("données").Cells(Rows.Count, 1).End(xlUp).Row
T1 = Sheets("données").Range("C1:E" & D1)
With Sheets("mag")
D2 = .Cells(Rows.Count, 1).End(xlUp).Row
T2 = .Range("C1:I" & D2)
For I1 = 1 To D1
For I2 = 1 To D2
'1 pour C, 3 por E et 7 pour I
If T1(I1, 1) = T2(I2, 1) Then
If T1(I1, 3) = T2(I2, 7) Then
If .Rows(I2).Interior.ColorIndex = 3 Then
Exit For 'Inutile de continuer, la valeur de T1 a déjà ete traitée (cas de doublon dans T1)
Else
.Rows(I2).Interior.ColorIndex = 3
End If
End If
End If
Next
Next
End With
End Sub |
Partager