Bpnjpur
Bjonjour à tous
Un essai à tester. Te convient-il ?
Option Explicit
Private Sub CommandButton1_Click()
If ComboBox1 = "" Then
MsgBox "Sélectionner ou saisissez un poste.", 16
Exit Sub
End If
If WorksheetFunction.CountIf(Range("Poste"), ComboBox1) = 0 Then
Range("B" & Rows.Count).End(xlUp)(2).Value = ComboBox1
MsgBox "Le poste " & ComboBox1 & " à été ajouté car il n'existait pas."
End If
MsgBox "Le Poste " & ComboBox1 & " est actif.", 16
End Sub
Private Sub CommandButton2_Click()
If ComboBox2 = "" Then
MsgBox "Sélectionner ou saisissez une typologie.", 16
Exit Sub
End If
If WorksheetFunction.CountIf(Range("Typologie"), ComboBox12) = 0 Then
Range("D" & Rows.Count).End(xlUp)(2).Value = ComboBox2
MsgBox "La typologie" & ComboBox2 & " à été ajoutée car elle n'existait pas."
End If
MsgBox "La typologie " & ComboBox2 & " est active.", 16
End Sub
Private Sub UserForm_initialize()
ComboBox1.List = Sheets("Feuil1").Range("Poste").Value
ComboBox2.List = Sheets("Feuil1").Range("Typologie").Value
End Sub
Bye !