Private Sub TextCode_Change()
Dim CtrlOb As Control
With Sheets("Liste agents").ListObjects("t_Noms")
Set trouve = .ListColumns("Code").Range.Find(Me.TextCode, lookat:=xlWhole)
If Not trouve Is Nothing Then
Me.Tbx_Noms = trouve.Offset(0, 1)
End If
End With
With Sheets("Saisie").ListObjects("t_Saisie")
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.Tbx_Commentaire = trouve.Offset(0, 9)
For Each Ctrl In Me.Frame2.Controls
If TypeName(Ctrl) = "TextBox" Then
Nom = Replace(Ctrl.Name, "Tbx_", "")
If Nom <> "Tbx_DateJour" Then
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