De listbox multi colonne a une autre multi colonne

Résolu/Fermé
Saddoud walid - 10 nov. 2014 à 16:45
 Saddoud walid - 12 nov. 2014 à 09:54
Bonjour,


Je cherche à ajoute une ligne d'une listbox multi colonne à une autre listbox multi colonne sans modifier l'ordre de colonne, j'ai pu ajouter une seul colonne :
Le code de cette colonne est :
Private Sub CommandButton2_Click()
With ListBox2
.ColumnCount = 4
.ColumnWidths = "80;400;100;100"
.RowSource = ""
End With
For i = 0 To ListBox1.ListCount - 1
IF ListBox1.Selected(i) = True Then ListBox2.AddItem ListBox1.List(i, 0)
Next i
End Sub
Merci d'avance
A voir également:

2 réponses

f894009 Messages postés 17185 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 15 avril 2024 1 701
10 nov. 2014 à 17:53
Bonjour,

Private Sub CommandButton2_Click()
With ListBox2
.ColumnCount = 4
.ColumnWidths = "80;400;100;100"
.RowSource = ""
.Clear
End With
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
ListBox2.AddItem ListBox1.List(i, 0)
ListBox2.List(ListBox2.ListCount - 1, 1) = ListBox1.List(i, 1)
ListBox2.List(ListBox2.ListCount - 1, 2) = ListBox1.List(i, 2)
ListBox2.List(ListBox2.ListCount - 1, 3) = ListBox1.List(i, 3)
End If
Next i
End Sub
1
merci bien f894009, bien fait
0