14 colonnes et plus dans listBox

Fermé
AHTOUATI - Modifié par baladur13 le 5/12/2016 à 18:30
Whismeril Messages postés 19025 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 19 avril 2024 - 5 déc. 2016 à 16:46
Bonjour,
je voudrai programmé 14 colonnes dans une listBox mais malheureusement cette liste n'accepte que 10 colonnes et voila le programme

Private Sub LISTER_Click()
Dim Critère
Dim DerniereLigne As Integer, x As Integer

Critère = listeBox1
If Cells(Rows.Count, 1).End(xlUp).Row = 1 Then
       DerniereLigne = 2
Else
     DerniereLigne = Cells(Rows.Count, 1).End(xlUp).Row
End If
ZoneBox1.Clear
ZoneBox1.BackColor = RGB(300, 250, 0)
          For x = 1 To DerniereLigne
                If Cells(x, 14) = Critère Then
                 Me.ZoneBox1.AddItem Cells(x, 1)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 1) = Cells(x, 2)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 2) = Cells(x, 3)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 3) = Cells(x, 4)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 4) = Cells(x, 5)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 5) = Cells(x, 6)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 6) = Cells(x, 7)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 7) = Cells(x, 8)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 8) = Cells(x, 9)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 9) = Cells(x, 10)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 10) = Cells(x, 11)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 11) = Cells(x, 12)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 12) = Cells(x, 13)
                 Me.ZoneBox1.List(Me.ZoneBox1.ListCount - 1, 13) = Cells(x, 14)


End If
        Next x


End Sub


merci d'avance

EDIT : Ajout des balises de code (la coloration syntaxique).
Explications disponibles ici : ICI

Merci d'y penser dans tes prochains messages.
A voir également:

1 réponse

Whismeril Messages postés 19025 Date d'inscription mardi 11 mars 2003 Statut Contributeur Dernière intervention 19 avril 2024 929
5 déc. 2016 à 16:46
Bonsoir
Et pourquoi ne pas utiliser un datagrid?
https://excel.developpez.com/faq/?page=Controle#DataGrid
0