Private Sub TextCode_Change()
'
Dim Ctrl As Control
Dim Trouve As Range
Set Trouve = Range("t_Noms[Code]").Find(Me.TextCode, lookat:=xlWhole)
If Not Trouve Is Nothing Then Me.T_bx_Noms = Trouve.Offset(0, 1)
With Range("t_Saisie").ListObject
Set Trouve = .ListColumns("Code agent").Range.Find(Me.TextCode, lookat:=xlWhole)
If Not Trouve Is Nothing Then
Me.Tbx_DebMat.Value = Format(Trouve.Offset(0, 3), "hh:mm")
Me.Tbx_FinMat.Value = Format(Trouve.Offset(0, 4), "hh:mm")
Me.Tbx_DebAPM.Value = Format(Trouve.Offset(0, 5), "hh:mm")
Me.Tbx_FinAPM.Value = Format(Trouve.Offset(0, 6), "hh:mm")
Me.Tbx_DebSoir.Value = Format(Trouve.Offset(0, 7), "hh:mm")
Me.Tbx_FinSoir.Value = Format(Trouve.Offset(0, 8), "hh:mm")
Me.T_bx_Commentaire = Trouve.Offset(0, 9)
For Each Ctrl In Me.Frame2.Controls
If TypeName(Ctrl) = "TextBox" Then
If Left(Ctrl.Name, 4) = "Tbx_" Then
Nom = Replace(Ctrl.Name, "Tbx_", "")
Ctrl.Enabled = (Ctrl.Value = "")
Me.Frame2.Controls("Chk_" & Nom).Enabled = (Ctrl.Value = "")
Me.Frame2.Controls("Chk_" & Nom).Visible = (Ctrl.Value = "")
End If
End If
Next Ctrl
End If
End With
End Sub