Sub Ajout_Histo(Tg As Variant, lg As Integer, idx As Integer)
Dim L As Single, T As Single, W As Single, H As Single, lrg As Single
Dim txt As String, clr As Long, md As Single, H0 As Single
Dim Hdeb As Single, Hfin As Single, Absc As Boolean
Dim lig As Integer, Tnm As Variant

    With Sheets("Cfg")
        lig = .Cells(Rows.Count, "D").End(xlUp).Row
        Tnm = .Range("D1:D" & lig).Value
    End With
    
    With ActiveSheet
        lrg = .Columns(5).Width
        H0 = CSng(.Range("E7").Value)
        Hdeb = CSng(Tg(1, 4) - Int(Tg(1, 4)))
        If Hdeb < H0 Then Hdeb = Hdeb + 1
        Hfin = Hdeb + CSng(Tg(1, 5))
        
        T = .Rows(lg).Top + 2
        H = .Rows(lg).Height - 4
        L = .Columns(5).Left + lrg / 2 + (Hdeb - H0) / Pas * lrg
        W = Tg(1, 5) / Pas * lrg
        
        If Not IsNull(Tg(1, 6)) Then txt = Tg(1, 6)
        If Not IsNull(Tg(1, 7)) Then txt = txt & " - " & Tg(1, 7)
      
        If Tg(1, 8) Like "Absence*" Then
            clr = RGB(250, 5, 5)
            txt = "Absence"
            If Not IsNull(Tg(1, 10)) Then txt = txt & " - " & Tg(1, 10)
            Absc = True
        Else
            clr = Sheets("Cfg").Range("D" & Idx_T2D(Tnm, Tg(1, 6), 1)).Interior.Color
            .Range("CY" & lg).Value = .Range("CY" & lg).Value + CSng(Tg(1, 5))
        End If
        
        Histo Tg(1, 1), L, T, W, H, txt, lg, False, clr
        
        md = T + H / 2 - 5
        Etiquettes Tg(1, 1), lg, L + 10, Format(Hdeb, "hh:nn"), md, 1       ' H début
        Etiquettes Tg(1, 1), lg, L + W - 10, Format(Hfin, "hh:nn"), md, 2   ' H fin

    End With
End Sub