Bonjour, j'utilise le code suivant (copié sur le forum)
Cela marche impec et l'affichage dans la ListBox ce fait bien.
Mais j'aimerais qu'en plus de m'afficher les colonne C et D il m'affiche la colonne E et H (sur la même ligne)
Si possible en m’expliquant pour que je comprenne encore merci à tous les contributeurs.
Private Sub TextBox1_Change()
i = 0
Set plage = Sheets("BD").Range("C3:C" & Sheets("BD").Range("C65536").End(xlUp).Row)
Set plage_a = Sheets("BD").Range("C3😀" & Sheets("BD").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 = 2
.ColumnWidths = "80;200"
End With
With Sheets("BD")
If .Range("B3") <> "" Then
Lg = .Range("B65536").End(xlUp).Row
End If
For Mtg = 3 To Lg
If .Cells(Mtg, 3).Value <> "" Then
ListBox1.AddItem .Cells(Mtg, 3)
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(Mtg, 4)
End If
Next Mtg
ListBox1.ListIndex = -1
If ListBox1.ListCount > 0 Then ListBox1.ListIndex = 0
End With
End Sub
Cela marche impec et l'affichage dans la ListBox ce fait bien.
Mais j'aimerais qu'en plus de m'afficher les colonne C et D il m'affiche la colonne E et H (sur la même ligne)
Si possible en m’expliquant pour que je comprenne encore merci à tous les contributeurs.
Private Sub TextBox1_Change()
i = 0
Set plage = Sheets("BD").Range("C3:C" & Sheets("BD").Range("C65536").End(xlUp).Row)
Set plage_a = Sheets("BD").Range("C3😀" & Sheets("BD").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 = 2
.ColumnWidths = "80;200"
End With
With Sheets("BD")
If .Range("B3") <> "" Then
Lg = .Range("B65536").End(xlUp).Row
End If
For Mtg = 3 To Lg
If .Cells(Mtg, 3).Value <> "" Then
ListBox1.AddItem .Cells(Mtg, 3)
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(Mtg, 4)
End If
Next Mtg
ListBox1.ListIndex = -1
If ListBox1.ListCount > 0 Then ListBox1.ListIndex = 0
End With
End Sub