Option Compare Text
Dim f, Rng, ColVisu(), TBlBD()
Private Sub UserForm_Initialize()
Set f = Sheets("ListeDesDevis") ' Adapter
nomTableau = "ListeDevis1"
TBlBD = Range(nomTableau).Value
Set Rng = f.Range("A2:G" & f.[A65000].End(xlUp).Row) ' Adapter
ColVisu = Array(1, 2, 4, 6) ' Adapter
LargeurCol = Array(60, 50, 50, 100) ' Adapter
Me.ListBox1.ColumnCount = UBound(ColVisu) + 1
Me.ListBox1.ColumnWidths = Join(LargeurCol, ";")
Me.ListBox1.List = Application.Index(Rng, Evaluate("Row(1:" & Rng.Rows.Count & ")"), ColVisu)
'--- ComboBox
Set d = CreateObject("scripting.dictionary")
d("*") = ""
For i = 1 To UBound(TBlBD): d(TBlBD(i, 26)) = "": Next i
Me.ComboBox2.List = d.keys
End Sub
Private Sub ComboBox2_click()
ColRecherche = 26
clé = Me.ComboBox2: n = 0
Dim Tbl()
For i = 1 To UBound(TBlBD)
If TBlBD(i, ColRecherche) Like clé Then
n = n + 1: ReDim Preserve Tbl(1 To UBound(TBlBD, 2), 1 To n)
For k = 1 To UBound(TBlBD, 2): Tbl(k, n) = TBlBD(i, k): Next k
End If
Next i
If n > 0 Then Me.ListBox1.Column = Tbl Else Me.ListBox1.Clear
End Sub