Bonsoir à tous!
Bonsoir Jean-Eric, Vincval
ou un petit code VBA à placer dans un module standard
Sub test()
Dim dl, dercol, col
Dim F1, F2 As Worksheet
Set F1 = Worksheets("base")
Set F2 = Worksheets("résultat attendu")
dl = F1.Range("A" & Rows.Count).End(xlUp).Row
dercol = F1.Cells(1, Columns.Count).End(xlToLeft).Column
F2.Range("A:R").ClearContents
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
F2.Range("N1:R1") = Array("N", "S", "M", "J", "R")
For col = 14 To 18
For i = 2 To dl
For j = 2 To dercol
If F1.Cells(i, j).Value = F2.Cells(1, col).Value Then
F2.Range("A" & Rows.Count).End(xlUp).Offset(1, 0) = F1.Cells(i, 1)
F2.Range("B" & Rows.Count).End(xlUp).Offset(1, 0) = F2.Cells(1, col)
F2.Range("C" & Rows.Count).End(xlUp).Offset(1, 0) = F1.Cells(1, j).Value
End If
Next j
Next i
Next col
F2.Range("A1:C1") = Array("Date", "Poste", "Équipe")
F2.Range("A1:C1").Font.Bold = True
F2.Range("A:A").NumberFormat = "dd/mm/yyyy"
F2.Columns("A:C").HorizontalAlignment = xlCenter
F2.Columns("A:C").AutoFit
F2.Range("A1").CurrentRegion.Sort Key1:=F2.Range("A1"), Order1:=xlAscending, Header:=xlYes
F2.Range("N1:R1").ClearContents
Application.ScreenUpdating = True
Application.EnableEvents = True
Application.Calculation = xlCalculationAutomatic
End Sub
Bonne soirée !