XL 2010 Valider avec un un seul textbox selon le choix

Appo1985

XLDnaute Occasionnel
Bonjour à tous.
Je voudrais si possible pouvoir valider mes notes selon le choix de la matière dans le premier combobox et afficher le code si je saisie le PV et vice versa. Les deux premières colonnes étant déjà rempli à l'avance je ne voudrais pas qu'il soit possible de pouvoir saisir un nouveau code ou un nouveau PV. Merci d'avance pour votre aide.
Ci-joint mon fichier
 

Pièces jointes

  • validation note.xlsm
    19.7 KB · Affichages: 1
Solution
Bonjour Appo,
Si j'ai bien compris, un essai en PJ avec :
VB:
Private Sub ComboBox1_Change()
    ComboBox2.Value = Cells(Application.Match(Val(ComboBox1.Value), Sheets("Feuil1").[A:A], 0), "B")
End Sub
Private Sub ComboBox2_Change()
    ComboBox1.Value = Cells(Application.Match(ComboBox2.Value, Sheets("Feuil1").[B:B], 0), "A")
End Sub
Private Sub CommandButton1_Click()
    On Error GoTo FinInsere: Dim L%, C%
    If ComboBox1.Value = "" Or ComboBox2.Value = "" Or ComboBox3.Value = "" Then Exit Sub
    If TextBox1.Value = "" Then MsgBox "Pas de note entrée.": Exit Sub
    With Sheets("Feuil1")
        L = Application.Match(Val(ComboBox1.Value), .[A:A], 0)
        C = Application.Match(ComboBox3.Value, .[3:3], 0)
        Cells(L, C) =...

sylvanu

XLDnaute Barbatruc
Supporter XLD
Bonjour Appo,
Si j'ai bien compris, un essai en PJ avec :
VB:
Private Sub ComboBox1_Change()
    ComboBox2.Value = Cells(Application.Match(Val(ComboBox1.Value), Sheets("Feuil1").[A:A], 0), "B")
End Sub
Private Sub ComboBox2_Change()
    ComboBox1.Value = Cells(Application.Match(ComboBox2.Value, Sheets("Feuil1").[B:B], 0), "A")
End Sub
Private Sub CommandButton1_Click()
    On Error GoTo FinInsere: Dim L%, C%
    If ComboBox1.Value = "" Or ComboBox2.Value = "" Or ComboBox3.Value = "" Then Exit Sub
    If TextBox1.Value = "" Then MsgBox "Pas de note entrée.": Exit Sub
    With Sheets("Feuil1")
        L = Application.Match(Val(ComboBox1.Value), .[A:A], 0)
        C = Application.Match(ComboBox3.Value, .[3:3], 0)
        Cells(L, C) = TextBox1.Value
    End With
    Unload UserForm1
FinInsere:
End Sub
 

Pièces jointes

  • validation note.xlsm
    22.5 KB · Affichages: 3

Discussions similaires

Statistiques des forums

Discussions
312 211
Messages
2 086 295
Membres
103 171
dernier inscrit
clemm