Textbox vers listbox

maval

XLDnaute Barbatruc
Bonjour,

J'ai une combobox pour faire mon choix et remplir les textbox.
J'aimerai après mon choix dans la combobox avoir les deux Listbox sélectionner en fonction des textbox 12 & 13
Je vous remercie d'avance
 

Pièces jointes

  • Textbox vers listbox.xlsm
    63.5 KB · Affichages: 36

Dranreb

XLDnaute Barbatruc
C'est plutôt toi qui a changé tout le programme alors qu'on était parti sur quelque chose de très prometteur au départ qui permettait des recherches dans tous les sens et auraient pu déboucher sur un système de mise à jour. Je ne comprends pas pourquoi tu est parti dans une toute autre direction beaucoup plus pauvre, compliquée et difficile à faire évoluer.
 

thebenoit59

XLDnaute Accro
Bonjour Max, Dranreb, Jecherche.

Une solution :
VB:
Private Sub ComboBox2_Change()
 TextBox1 = IIf(ComboBox2.ListIndex = -1, "", ComboBox2)
With Sheets("Données")
a = ComboBox2.ListIndex + 3
'TextBox9 = Sheets("Données").Range("E" & a)
            TextBox2 = Range("B" & a)
            TextBox3 = Range("J" & a)
            TextBox4 = Range("K" & a)
            TextBox5 = Range("L" & a)
            TextBox6 = Range("I" & a)
            TextBox7 = Range("H" & a)
            TextBox8 = Range("M" & a)
            TextBox9 = Range("E" & a)
            TextBox10 = Range("D" & a)
            TextBox12 = Range("F" & a)
            TextBox13 = Range("G" & a)
End With
    'Appel de la procédure créée.
    Selection_ListBox
End Sub

Private Sub Selection_ListBox()
Dim i%
With Me
    'ListBox Genre.
    For i = 0 To .ListBox2.ListCount - 1
        If .ListBox2.List(i) = .TextBox12.Text Then
            .ListBox2.Selected(i) = True
            Else: .ListBox2.Selected(i) = False
        End If
    Next i
    'ListBox Nationalité
    For i = 0 To .Listbox3.ListCount - 1
        If .Listbox3.List(i) = .TextBox13.Text Then
            .Listbox3.Selected(i) = True
            Else: .Listbox3.Selected(i) = False
        End If
    Next i
End With
End Sub
 

Statistiques des forums

Discussions
312 243
Messages
2 086 541
Membres
103 244
dernier inscrit
lavitzdecreu