voici le code sachant que j'ai un autre combobox = combobox1 sur mon userforme car dans le code il y'a 3combobox : combobox 1et dat1 sur userforme et un autre combobox=annee sur une feuille
Private Sub enregistrer1_Click()
Application.ScreenUpdating = False
If Me.dat1 = "" Then
lblMessage = " Veuillez choisir dans la liste l'année !"
Me.dat1.SetFocus
Exit Sub
ElseIf Me.montant1 = "" Then
lblMessage = " Veuillez entrer le montant!"
Me.montant1.SetFocus
Exit Sub
Else
Worksheets("Dépences").annee.Value = Entrées_Dépences.dat1.Value
Sheets("Dépences").Select
For i = 12 To 27
If Cells(i, 2) = Me.ComboBox1.Value Then
Cells(i, 4).Value = Me.montant1.Value
End If
Next
End If
lblMessage = " L'enregistrement c'est bien dérouler?."
Me.ComboBox1 = ""
Me.montant1 = ""
Me.dat1 = ""
Me.ComboBox1.SetFocus
Application.ScreenUpdating = True
End Sub