Re : Ajout d'affichage de colonne dans une listbox
Re
Non les colonnes ne sont pas vide mais malgré mes essais pas de résultat, je remets le code ci dessous.
Merci des vos aides pour me dire ce qu'il cloche
Private Sub TextBox1_Change()
i = 0
Set plage = Sheets("F2").Range("C3:C" & Sheets("F2").Range("C65536").End(xlUp).Row)
Set plage_a = Sheets("F2").Range("C3
" & Sheets("F2").Range("D65536").End(xlUp).Row)
NbCol = plage.Columns.Count
Me.ListBox1.Clear
Set c = plage_a.Find(Me.TextBox1, , , xlPart)
If Not c Is Nothing Then
premier = c.Address
Do
Me.ListBox1.AddItem
lig = c.Row - plage.Row + 1
For col = 1 To NbCol
Me.ListBox1.List(i, col - 1) = plage.Cells(lig, col)
Me.ListBox1.List(ListBox1.ListCount - 1, 1) = plage.Cells(lig, col + 1)
Next col
i = i + 1
Set c = plage_a.FindNext(c)
Loop While Not c Is Nothing And c.Address <> premier
End If
If Me.TextBox1 = "" Then Call Initlistbox1
End Sub
Sub Initlistbox1()
With ListBox1
.Clear
.ColumnCount = 4
.ColumnWidths = "80;270;40;40"
End With
With Sheets("F2")
If .Range("B3") <> "" Then
Lg = .Range("B65536").End(xlUp).Row
End If
For Mtg = 3 To Lg
If .Cells(Mtg, 8).Value <> "" Then
ListBox1.AddItem .Cells(Mtg, 3)
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(Mtg, 4)
ListBox1.List(ListBox1.ListCount - 1, 2) = .Cells(Mtg, 5)
ListBox1.List(ListBox1.ListCount - 1, 3) = .Cells(Mtg, 8)
End If
Next Mtg
ListBox1.ListIndex = -1
If ListBox1.ListCount > 0 Then ListBox1.ListIndex = 0
End With
End Sub