Salut Danval,
Salut l'équipe,
si j'ai bien compris le truc...
Ouvrir la feuille 'Fin' démarre la macro...
Private Sub Worksheet_Activate()
'
Dim tData, tExtract, dDate As Date, iDif1%, iDif2%, iHr1%, iHr2%, iEnd%
'
Application.ScreenUpdating = False
'
With Worksheets("Export")
tData = .Range("A4").Resize(.Range("A" & Rows.Count).End(xlUp).Row - 3, 4).Value
Range("A2:Y" & Range("A" & Rows.Count).End(xlUp).Row + 1).Delete shift:=xlUp
tExtract = Range("A2:Y" & 2 + DateDiff("d", CDate(.[A4]), CDate(.Range("A" & Rows.Count).End(xlUp).Value))).Value
End With
'
dDate = CDate(tData(1, 1)) - 1
For x = 1 To UBound(tData, 1)
iDif1 = DateDiff("d", dDate, CDate(tData(x, 1)))
iDif2 = DateDiff("d", dDate, CDate(tData(x, 3)))
iEnd = IIf(iDif2 > iEnd, iDif2, iEnd)
iHr1 = CInt(Split(tData(x, 2), "h")(0)) + 1
iHr2 = CInt(Split(tData(x, 4), "h")(0)) + IIf(CInt(Split(tData(x, 4), "h")(1)) > 0, 1, 0)
For y = iDif1 To iDif2
tExtract(y, 1) = DateAdd("d", y, dDate)
For Z = IIf(y = iDif1, 1 + iHr1, 2) To IIf(y = iDif2 Or iDif1 = iDif2, 1 + iHr2, 25)
tExtract(y, Z) = CInt(tExtract(y, Z)) + 1
Next
Next
Next
Range("A2").Resize(iEnd, 25).Value = tExtract
For x = 2 To Range("A" & Rows.Count).End(xlUp).Row Step 2
Range("A" & x & ":Y" & x).Interior.Color = RGB(215, 215, 215)
Next
Range("A2:Y" & Range("A" & Rows.Count).End(xlUp).Row).BorderAround LineStyle:=xlContinuous
'
Application.ScreenUpdating = True
'
End Sub
A+