Userform : Listebox multicolonne

sarah33

XLDnaute Junior

Pièces jointes

  • sarah33-test v1.xlsm
    36.4 KB · Affichages: 56
  • sarah33-test v1.xlsm
    36.4 KB · Affichages: 59
  • sarah33-test v1.xlsm
    36.4 KB · Affichages: 60
Dernière édition:

grisan29

XLDnaute Accro
Re : Userform : Listebox multicolonne

bonjour sarah33voici un code qui envoie la ligne cliqué dans listbox vers des textbox
Code:
Private Sub Listbox1_click()

With ListBox1
    TextBox2 = .List(.ListIndex, 0)
    TextBox3 = .List(.ListIndex, 1)
    TextBox4 = .List(.ListIndex, 2)
    TextBox5 = .List(.ListIndex, 3)
    TextBox6 = .List(.ListIndex, 4)
    TextBox7 = .List(.ListIndex, 5)
    TextBox8 = .List(.ListIndex, 7)
End With
End Sub

Pascal
 

laetitia90

XLDnaute Barbatruc
Re : Userform : Listebox multicolonne

bonjour sarah33 ,grisan29

peu faire une boucle egalement seulement deplacer tes box sur ton user dans la bonne dans chrono de 2 a 9

Code:
Private Sub ListBox1_Click()
  For y = 2 To 9: Me("Textbox" & y) = ListBox1.List(ListBox1.ListIndex, y - 2): Next y
End Sub


ps variable y declarer en byte en debut module
 

grisan29

XLDnaute Accro
Re : Userform : Listebox multicolonne

Bonjour Staple1600,laetitia90,sarah33 et le forum
Staple1600 c'est vrai qu'un "bonjour" en début de post donne celui ci plus agréable a lire :cool:

Laetitia90 merveilleuse réduction de code :cool:

sarah33 en bonus si tu veux ajouter le contenu des textbox dans la listbox2 voici un code a potasser
Code:
Private Sub CommandButton1_Click()
ListBox2.ColumnCount = 3
ListBox2.AddItem (TextBox2.Value)
ListBox2.List(ListBox1.ListCount - 1, 1) = TextBox3.Value
ListBox2.List(ListBox1.ListCount - 1, 2) = TextBox4.Value
'etc...........
Me.TextBox2.Value = ""
Me.TextBox3.Value = ""
Me.TextBox4.Value = ""
'etc........
End Sub

Pascal
 
Dernière édition:

Discussions similaires

Réponses
12
Affichages
319

Statistiques des forums

Discussions
312 216
Messages
2 086 351
Membres
103 195
dernier inscrit
martel.jg