Bonjour à tous,
J'ai besoin de filtrer une listbox par une référence exact. Voici la fonction :
Function FilterListBoxExactMatch()
Dim i As Long, j As Long
Dim searchText As String
Dim lastCol As Long
searchText = LCase(TextBox36.Text)
On Error Resume Next
ListBox2.Clear
With Sheets("SaveChannel")
lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
For i = 1 To .Cells(.Rows.Count, 34).End(xlUp).Row
If LCase(.Cells(i, 34).Value) = searchText Then
ListBox2.AddItem .Cells(i, 1).Value
For j = 2 To lastCol
ListBox2.List(ListBox2.ListCount - 1, j - 1) = .Cells(i, j).Value
Next j
End If
Next i
End With
End Function
Ma ListBox2 contient l' ID(32), la période(33), la référence(34), quantité1(35), quantité2(36), quantité3(37) en format "50;50;150;0;0;0".
Quand j'appel ma fonction dans ma textbox change, je ne trouve aucune des données que je cherche, la ListBox2 est totalement vierge.
Est-ce un problème dans la fonction? ou de l'affichage de la ListBox2?
Merci pour votre retour,
Bonne journée,
RQ