Option Explicit
Dim lig&, col%
Private Sub txtPrénom_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 27 Then Unload Me
End Sub
Private Sub Job(chn$, k As Byte)
With Cells(lig, col).Offset(k)
If chn = "" Then
.NumberFormat = "General": .Value = Empty
Else
If InStr(chn, ":") = 0 Then chn = chn & ":00"
If IsDate(chn) Then
.NumberFormat = "hh:mm": .Value = CDate(chn)
End If
End If
End With
End Sub
Private Sub cmdOK_Click()
Dim chn$: lig = ActiveCell.Row: col = ActiveCell.Column: chn = txtPrénom
Cells(lig, col) = IIf(chn = "", Empty, chn): Job txtH1, 1: Job txtH2, 2
End Sub