Combobox et conditions

Bonjour a tous,

Je veux avec mon Userform2, pouvoir attribuer une valeur dans la colonne correspondante au choix de ma combobox2.

J'ai essayer avec la condition mais cela ne fonctionne pas.

If Me.ComboBox2.Value = Septembre Then a = 4

If Me.ComboBox2.Value = Octobre Then a = 5

If Me.ComboBox2.Value = Novembre Then a = 6

If Me.ComboBox2.Value = Decembre Then a = 7

If Me.ComboBox2.Value = Janvier Then a = 8

If Me.ComboBox2.Value = Fevrier Then a = 9

If Me.ComboBox2.Value = Mars Then a = 10

If Me.ComboBox2.Value = Avril Then a = 11

If Me.ComboBox2.Value = Mai Then a = 12

If Me.ComboBox2.Value = Juin Then a = 13

J’espère être clair.

Ci joint mon fichier.

Merci pour votre aide.

10test.xlsm (26.06 Ko)

Bonjour,

à tester,

Private Sub CommandButton1_Click()
    colonne = Application.Match(Me.ComboBox2, f.Rows(1), 0)
    f.Cells(ligne, colonne) = Me.TextBox1 - (Me.TextBox2 - 1)
    Me.TextBox2 = ""
End Sub

Merci !!

Ça fonctionne parfaitement.

Rechercher des sujets similaires à "combobox conditions"