Re : Combobox et listbox
Re bonjour,
J'ai mis le code suivant dans la listbox il y a que les "En cours" qui sont affiché
mais est-il possible de ne pas afficher les ligne vide.
Private Sub ComboBox1_Change()
Dim Cell As Range
Dim NbLigneUtilisée As Byte
Me.ListBox1.Clear
Me.Label5.Caption = ""
With Sheets("MBIO")
For Each Cell In .Range("A5:A" & .Range("A65536").End(xlUp).Row)
If CStr(Cell.Offset(0, 1)) = Me.ComboBox1 Then
Me.ListBox1.AddItem
If Cell.Offset(0, 9) = "Valider" Then Me.ListBox1.List(NbLigneUtilisée, 0) = ""
If Cell.Offset(0, 9) = "En cours" Then Me.ListBox1.List(NbLigneUtilisée, 0) = Cell.Offset(0, 1)
If Cell.Offset(0, 9) = "Valider" Then Me.ListBox1.List(NbLigneUtilisée, 1) = ""
If Cell.Offset(0, 9) = "En cours" Then Me.ListBox1.List(NbLigneUtilisée, 1) = Cell.Offset(0, 2)
If Cell.Offset(0, 9) = "Valider" Then Me.ListBox1.List(NbLigneUtilisée, 2) = ""
If Cell.Offset(0, 9) = "En cours" Then Me.ListBox1.List(NbLigneUtilisée, 2) = Cell.Offset(0, 3)
If Cell.Offset(0, 9) = "Valider" Then Me.ListBox1.List(NbLigneUtilisée, 3) = ""
If Cell.Offset(0, 9) = "En cours" Then Me.ListBox1.List(NbLigneUtilisée, 3) = Cell.Offset(0, 9)
If Cell.Offset(0, 9) = "Valider" Then Me.ListBox1.List(NbLigneUtilisée, 4) = ""
If Cell.Offset(0, 9) = "En cours" Then Me.ListBox1.List(NbLigneUtilisée, 4) = Cell.Offset(0, 4)
NbLigneUtilisée = NbLigneUtilisée + 1
End If
Next
End With
End Sub
Merci d'avance.