Sub Detail()
Dim Dat As Date, TE(), LE&, LEDéb&, CE&, TS(1 To 48, 1 To 8), LS&, CS&, HFC As Date, LS2&, CS2&
Dat = Feuil3.[C4].Value
TE = Feuil1.UsedRange.Value
LS = 6
For LE = 2 To UBound(TE, 1)
If TE(LE, 1) = Dat Then
If HFC < TE(LE, 4) Then HFC = TE(LE, 4)
If LEDéb = 0 Then LEDéb = LE
TS(LS + 2, CS + 2) = "Client " & Format(TE(LE, 4), "hh:mm") & " :" ' = "Client :"
TS(LS + 2, CS + 3) = TE(LE, 5)
LS2 = LS + 3: CS2 = CS + 2
For CE = 6 To 15
If TE(LE, CE) <> 0 Then
LS2 = LS2 + 1
TS(LS2, CS2) = TE(1, CE)
TS(LS2, CS2 + 1) = TE(LE, CE): End If: Next CE
CS = (CS + 4) Mod 8: If CS = 0 Then LS = LS + 14
End If: Next LE
TS(4, 2) = "Date": TS(4, 3) = Dat
If LEDéb > 0 Then
TS(2, 2) = "Chef d'Équipe": TS(2, 3) = TE(LEDéb, 2)
TS(2, 6) = "Heure fin camion": TS(2, 7) = HFC
TS(4, 6) = "Immat Remorque": TS(4, 7) = TE(LEDéb, 3): End If
Feuil3.[A1:H48].Value = TS
End Sub