Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

XL 2016 filtrer un élément dans une listbox vba

borain

XLDnaute Nouveau
Bonjour,
J'AI CREER UN FICCHIER
qui me permet de visualiser des photos de mon inventaire
et jai une listbox que jai ajouter dans mon userform, j'aimerai faire des filtre
et le code que j'utilise d'habitude pour mes filtres ne fonctionne pas
lorsque j'efface l'element filtrer la listbox est censé rechargé mais sa blog
jai besoin d'aide si quelqu'un veut bien .

cdlt,
VB:
Sub AlimenteListbox()
Dim J As Long, i As Integer, Indice As Integer, D As Integer, T2()

  Me.ListBox1.Clear
  Indice = 1            ' Par défaut toujours 1 enregistrement
  For J = 1 To UBound(T1)
    If T1(J, 5) Like Me.CbbPerso & "*" And T1(J, 8) Like Me.CbbType & "*" And T1(J, 4) Like Me.TbRechFiche & "*" And T1(J, 1) Like Me.Textdate & "*" Then
      Indice = Indice + 1
      ReDim Preserve T2(1 To 26, 1 To Indice)
      For i = 1 To UBound(T1, 2)
        T2(i, Indice) = T1(J, i)
      Next i
      For D = 1 To UBound(T1, 1)
      Next D
    End If
  Next J
  If Indice > 1 Then
    Me.ListBox1.List = Application.Transpose(T2)
    Me.ListBox1.RemoveItem 0          ' On supprime l'enregistrement par défaut
  End If

End Sub
Sub AlimenteListbox()
Dim J As Long, i As Integer, Indice As Integer, D As Integer, T2()

  Me.ListBox1.Clear
  Indice = 1            ' Par défaut toujours 1 enregistrement
  For J = 1 To UBound(T1)
    If T1(J, 5) Like Me.CbbPerso & "*" And T1(J, 8) Like Me.CbbType & "*" And T1(J, 4) Like Me.TbRechFiche & "*" And T1(J, 1) Like Me.Textdate & "*" Then
      Indice = Indice + 1
      ReDim Preserve T2(1 To 26, 1 To Indice)
      For i = 1 To UBound(T1, 2)
        T2(i, Indice) = T1(J, i)
      Next i
      For D = 1 To UBound(T1, 1)
      Next D
    End If
  Next J
  If Indice > 1 Then
    Me.ListBox1.List = Application.Transpose(T2)
    Me.ListBox1.RemoveItem 0          ' On supprime l'enregistrement par défaut
  End If

End Sub
 

Discussions similaires

Réponses
11
Affichages
297
Réponses
2
Affichages
103
Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…