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.Lbl_DebMat.Caption = Format(trouve.Offset(0, 3), "hh:mm")
Me.Lbl_FinMat.Caption = Format(trouve.Offset(0, 4), "hh:mm")
Me.Lbl_DebAPM.Caption = Format(trouve.Offset(0, 5), "hh:mm")
Me.Lbl_FinAPM.Caption = Format(trouve.Offset(0, 6), "hh:mm")
Me.Lbl_DebSoir.Caption = Format(trouve.Offset(0, 7), "hh:mm")
Me.Lbl_FinSoir.Caption = Format(trouve.Offset(0, 8), "hh:mm")
Me.Tbx_Commentaire = trouve.Offset(0, 9)
For Each Ctrl In Me.Frame2.Controls
If TypeName(Ctrl) = "Label" Then
Nom = Replace(Ctrl.Name, "Lbl_", "")
If Nom <> "TotJour" Then 'il s'agit aussi d'un label, mais pas concerné
Ctrl.Enabled = (Ctrl.Caption = "")
Me.Frame2.Controls("Chk_" & Nom).Enabled = (Ctrl.Caption = "")
Me.Frame2.Controls("Chk_" & Nom).Visible = (Ctrl.Caption = "")
End If
End If
Next Ctrl
' Me.Chk_DebMat.Enabled = (Me.Lbl_DebMat.Caption = "")
' Me.Chk_DebMat.Visible = (Me.Lbl_DebMat.Caption = "")
' Me.Lbl_DebMat.Enabled = (Me.Lbl_DebMat.Caption = "")
'
' Me.Chk_DebAPM.Enabled = (Me.Lbl_DebAPM.Caption = "")
' Me.Chk_DebAPM.Visible = (Me.Lbl_DebAPM.Caption = "")
' Me.Lbl_DebAPM.Enabled = (Me.Lbl_DebAPM.Caption = "")
'
' Me.Chk_DebSoir.Enabled = (Me.Lbl_DebSoir.Caption = "")
' Me.Chk_DebSoir.Visible = (Me.Lbl_DebSoir.Caption = "")
' Me.Lbl_DebSoir.Enabled = (Me.Lbl_DebSoir.Caption = "")
'
' Me.Chk_FinMat.Enabled = (Me.Lbl_FinMat.Caption = "")
' Me.Chk_FinMat.Visible = (Me.Lbl_FinMat.Caption = "")
' Me.Lbl_FinMat.Enabled = (Me.Lbl_FinMat.Caption = "")
'
' Me.ChK_FinAPM.Enabled = (Me.Lbl_FinAPM.Caption = "")
' Me.ChK_FinAPM.Visible = (Me.Lbl_FinAPM.Caption = "")
' Me.Lbl_FinAPM.Enabled = (Me.Lbl_FinAPM.Caption = "")
'
' Me.Chk_FinSoir.Enabled = (Me.Lbl_FinSoir.Caption = "")
' Me.Chk_FinSoir.Visible = (Me.Lbl_FinSoir.Caption = "")
' Me.Lbl_FinSoir.Enabled = (Me.Lbl_FinSoir.Caption = "")
End If
End With
End Sub