Sub Coloriage()
Dim objCollabos As Object, Col1 As Range, ChampCible As Range, NbLignes As Long, NbColonnes As Long, i%, j%, wkCollabos As Worksheet, wkProd As Worksheet
Set wkCollabos = ThisWorkbook.Worksheets("BDD Fiches de Formation")
Set objCollabos = wkCollabos.ListObjects("_Collaborateurs")
Set wkProd = ThisWorkbook.Worksheets("MdP Prod")
Set Col1 = objCollabos.ListColumns("Colonne1").DataBodyRange
Set ChampCible = wkProd.Range("PolyProd[[Colonne2]:[a415]]") '$N$14:$PM$79 - si des colonnes sont ajoutées APRÈS la colonne PM, remplacer la dernière valeur entre crochets (ici a415) par le nouveau nom de la dernière colonne
NbLignes = ChampCible.Rows.Count
NbColonnes = ChampCible.Columns.Count
Application.ScreenUpdating = False
usfInfo.Afficher
For i = 1 To NbLignes
usfInfo.Actualiser CInt((i / NbLignes) * 100)
For j = 1 To NbColonnes
If ChampCible.Cells(i, j) <> "" And (Application.WorksheetFunction.CountIf(Col1, wkProd.Cells(5, j + 13) & wkProd.Cells(i + 4, 1)) + Application.WorksheetFunction.CountIf(Col1, wkProd.Cells(6, j + 13) & wkProd.Cells(i + 4, 1)) + Application.WorksheetFunction.CountIf(Col1, wkProd.Cells(7, j + 13) & wkProd.Cells(i + 4, 1)) + Application.WorksheetFunction.CountIf(Col1, wkProd.Cells(8, j + 13) & wkProd.Cells(i + 4, 1))) > 0 Then
With ChampCible(i, j).Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 13590431
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Else
ChampCible(i, j).Interior.ColorIndex = xlColorIndexNone
End If
Next j
Next i
Application.ScreenUpdating = True
Set wkCollabos = Nothing
Set objCollabos = Nothing
Set wkProd = Nothing
Set Col1 = Nothing
Set ChampCible = Nothing
End Sub