Le 04/05/22 à 08:32, ThierryP a écrit :
> Private Sub Cbx_Choix_Salarié_Change()
> If Cbx_Choix_Salarié.value = "" Then
> Txt_Nom = "": Txt_Prénom = "": Txt_Matricule = "": Txt_Service = ""
> Feuil4.Range("Salarié") = ""
> End If
Bonjour,
J'ai fait le test suivant et tout va bien.
Ne pas utiliser la propriété "RowSource" pour définir le contenu d'un
combobox dans la mesure du possible.
'=====================================
Private Sub ComboBox1_Change()
If ComboBox1.Value = "" Then
Me.TextBox1.Text = ""
End If
End Sub
Private Sub UserForm_Initialize()
With Worksheets("Feuil1")
Me.ComboBox1.List = .Range("A1:A" & .Range("A" &
.Rows.Count).End(xlUp).Row).Value
End With
End Sub
'=====================================
On peut remplacer l'événement "Change" par la combinaison au besoin.
'-----------------------------
Private Sub ComboBox1_Click()
If ComboBox1.Value = "" Then
Me.TextBox1.Text = ""
End If
End Sub
'-----------------------------
Private Sub ComboBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger,
ByVal Shift As Integer)
If KeyCode = 46 Then
Me.TextBox1.Text = ""
End If
End Sub
'-----------------------------
MichD