De listbox multi colonne a une autre multi colonne

Résolu
Saddoud walid -  
 Saddoud walid -
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

2 réponses

  1. f894009 Messages postés 17417 Date d'inscription   Statut Membre Dernière intervention   1 717
     
    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
  2. Saddoud walid
     
    merci bien f894009, bien fait
    0