Liste déroulante via code vba
Bonjour à tous,
Après avoir été voir mon meilleur ami Google.., je n'ai pas trouvé de solution....
Voici l'histoire, lorsque j'ouvre mon fichier, un user form s'affiche avec une liste déroulante
Je souhaiterais que lorsque je sélectionne un choix dans la liste déroulante et que je clique sur ok, il renvoie vers un code VBA
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
Private Sub CommandButton1_Click() 'Valider
With Sheets("Listes")
.Range("B1") = UserForm1.ComboBox1
End With
If ComboBox1.Value = "text1" Then
Call Macro1
ElseIf ComboBox1.Value = "text2" Then
Call Macro2
ElseIf ComboBox1.Value = "text3" Then
Call Macro3
End If
End Sub
Private Sub CommandButton2_Click() 'Quitter
Unload Me
End Sub
Private Sub cmdAnnuler_Click()
End Sub
Private Sub UserForm_Initialize()
ComboBox1.RowSource = "Listes!B2:B4" 'Récupération des Données
End Sub |