Bonjour !
J'ai crée un userform qui est censé modifier une carte de restaurant, plus précisément les menus préexistants dans cette carte. Pour chaque menu, on choisit l'entrée le plat le dessert à modifier et on en inscrit un nouveau dans la textbox qui suit.
Je n'arrive pas à voir d'où vient le problème dans le code ; quand je fais marcher l'userform, je peux sélectionner les plats sans problème, mais quand je rentre un nom nouveau, aucune modification ne s'effectue...
Quelqu'un voit-il le problème ? Toutes vos remarques sont les bienvenues !
Merci d'avance
Private Sub ComboBox1_Afterupdate()
Sheets("Carte").Activate
If ComboBox1.Value = "Gourmand" Then ComboBox2.RowSource = "Carte!B45:B47"
If ComboBox1.Value = "Gourmand" Then ComboBox4.RowSource = "Carte!B49:B51"
If ComboBox1.Value = "Gourmand" Then ComboBox6.RowSource = "Carte!B53:B55"
If ComboBox1.Value = "Plaisir" Then ComboBox2.RowSource = "Carte!D45😀47"
If ComboBox1.Value = "Plaisir" Then ComboBox4.RowSource = "Carte!D49😀51"
If ComboBox1.Value = "Plaisir" Then ComboBox6.RowSource = "Carte!D53😀55"
If ComboBox1.Value = "Express" Then ComboBox2.RowSource = ""
If ComboBox1.Value = "Express" Then ComboBox4.RowSource = "Carte!F45:F47"
If ComboBox1.Value = "Express" Then ComboBox26.RowSource = "Carte!F50:F53"
If ComboBox1.Value = "Enfant" Then ComboBox2.RowSource = ""
If ComboBox1.Value = "Enfant" Then ComboBox4.RowSource = "Carte!H45:H47"
If ComboBox1.Value = "Enfant" Then ComboBox6.RowSource = "Carte!H49:H51"
End Sub
Private Sub ComboBox2_Change()
Sheets("Carte").Select
If ComboBox1.Value = "Gourmand" Then Range("B45").Select
If ComboBox1.Value = "Plaisir" Then Range("D45").Select
If ComboBox1.Value = "Express" Then Range("F45").Select
If ComboBox1.Value = "Enfant" Then Range("H45").Select
Do
If ActiveCell.Value = Menuchange!ComboBox2 Then
GoTo Modifier2
End If
If ActiveCell.Value <> Menuchange!ComboBox2 Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell.Value = ""
Modifier2:
ActiveCell.Value = Menuchange!TextBox2
End Sub
Private Sub ComboBox4_Change()
Sheets("Carte").Select
If ComboBox1.Value = "Gourmand" Then Range("B49").Select
If ComboBox1.Value = "Plaisir" Then Range("D49").Select
If ComboBox1.Value = "Express" Then Range("F45").Select
If ComboBox1.Value = "Enfant" Then Range("H45").Select
Do
If ActiveCell.Value = Menuchange!ComboBox4 Then
GoTo Modifier4
End If
If ActiveCell.Value <> Menuchange!ComboBox4 Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell.Value = ""
Modifier4:
ActiveCell.Value = Menuchange!TextBox3
End Sub
Private Sub ComboBox6_Change()
Sheets("Carte").Select
If ComboBox1.Value = "Gourmand" Then Range("B53").Select
If ComboBox1.Value = "Plaisir" Then Range("D53").Select
If ComboBox1.Value = "Express" Then Range("F49").Select
If ComboBox1.Value = "Enfant" Then Range("H49").Select
Do
If ActiveCell.Value = Menuchange!ComboBox6 Then
GoTo Modifier6
End If
If ActiveCell.Value <> Menuchange!ComboBox6 Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell.Value = ""
Modifier6:
ActiveCell.Value = Menuchange!TextBox4
End Sub
Private Sub CommandButton1_Click()
Sheets("Carte").Select
If ComboBox1.Value = "Gourmand" Then Range("C43").Select
If ComboBox1.Value = "Plaisir" Then Range("E43").Select
If ComboBox1.Value = "Express" Then Range("G43").Select
If ComboBox1.Value = "Enfant" Then Range("I43").Select
ActiveCell.Value = Menuchange!TextBox1
Sheets("Carte").Select
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
J'ai crée un userform qui est censé modifier une carte de restaurant, plus précisément les menus préexistants dans cette carte. Pour chaque menu, on choisit l'entrée le plat le dessert à modifier et on en inscrit un nouveau dans la textbox qui suit.
Je n'arrive pas à voir d'où vient le problème dans le code ; quand je fais marcher l'userform, je peux sélectionner les plats sans problème, mais quand je rentre un nom nouveau, aucune modification ne s'effectue...
Quelqu'un voit-il le problème ? Toutes vos remarques sont les bienvenues !
Merci d'avance
Private Sub ComboBox1_Afterupdate()
Sheets("Carte").Activate
If ComboBox1.Value = "Gourmand" Then ComboBox2.RowSource = "Carte!B45:B47"
If ComboBox1.Value = "Gourmand" Then ComboBox4.RowSource = "Carte!B49:B51"
If ComboBox1.Value = "Gourmand" Then ComboBox6.RowSource = "Carte!B53:B55"
If ComboBox1.Value = "Plaisir" Then ComboBox2.RowSource = "Carte!D45😀47"
If ComboBox1.Value = "Plaisir" Then ComboBox4.RowSource = "Carte!D49😀51"
If ComboBox1.Value = "Plaisir" Then ComboBox6.RowSource = "Carte!D53😀55"
If ComboBox1.Value = "Express" Then ComboBox2.RowSource = ""
If ComboBox1.Value = "Express" Then ComboBox4.RowSource = "Carte!F45:F47"
If ComboBox1.Value = "Express" Then ComboBox26.RowSource = "Carte!F50:F53"
If ComboBox1.Value = "Enfant" Then ComboBox2.RowSource = ""
If ComboBox1.Value = "Enfant" Then ComboBox4.RowSource = "Carte!H45:H47"
If ComboBox1.Value = "Enfant" Then ComboBox6.RowSource = "Carte!H49:H51"
End Sub
Private Sub ComboBox2_Change()
Sheets("Carte").Select
If ComboBox1.Value = "Gourmand" Then Range("B45").Select
If ComboBox1.Value = "Plaisir" Then Range("D45").Select
If ComboBox1.Value = "Express" Then Range("F45").Select
If ComboBox1.Value = "Enfant" Then Range("H45").Select
Do
If ActiveCell.Value = Menuchange!ComboBox2 Then
GoTo Modifier2
End If
If ActiveCell.Value <> Menuchange!ComboBox2 Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell.Value = ""
Modifier2:
ActiveCell.Value = Menuchange!TextBox2
End Sub
Private Sub ComboBox4_Change()
Sheets("Carte").Select
If ComboBox1.Value = "Gourmand" Then Range("B49").Select
If ComboBox1.Value = "Plaisir" Then Range("D49").Select
If ComboBox1.Value = "Express" Then Range("F45").Select
If ComboBox1.Value = "Enfant" Then Range("H45").Select
Do
If ActiveCell.Value = Menuchange!ComboBox4 Then
GoTo Modifier4
End If
If ActiveCell.Value <> Menuchange!ComboBox4 Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell.Value = ""
Modifier4:
ActiveCell.Value = Menuchange!TextBox3
End Sub
Private Sub ComboBox6_Change()
Sheets("Carte").Select
If ComboBox1.Value = "Gourmand" Then Range("B53").Select
If ComboBox1.Value = "Plaisir" Then Range("D53").Select
If ComboBox1.Value = "Express" Then Range("F49").Select
If ComboBox1.Value = "Enfant" Then Range("H49").Select
Do
If ActiveCell.Value = Menuchange!ComboBox6 Then
GoTo Modifier6
End If
If ActiveCell.Value <> Menuchange!ComboBox6 Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until ActiveCell.Value = ""
Modifier6:
ActiveCell.Value = Menuchange!TextBox4
End Sub
Private Sub CommandButton1_Click()
Sheets("Carte").Select
If ComboBox1.Value = "Gourmand" Then Range("C43").Select
If ComboBox1.Value = "Plaisir" Then Range("E43").Select
If ComboBox1.Value = "Express" Then Range("G43").Select
If ComboBox1.Value = "Enfant" Then Range("I43").Select
ActiveCell.Value = Menuchange!TextBox1
Sheets("Carte").Select
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub