Private tbl
Private tbase
Private sh As Worksheet
Private Sub UserForm_Initialize()
Dim DL As Long, Coll As Long, I As Long, K
Me.StartUpPosition = 0
Me.Top = 0
Me.Left = Application.UsableWidth - Me.Width
Set sh = Sheets("Grille_de_Dispensation")
DL = sh.Range("A" & Rows.Count).End(xlUp).Row
sh.Range("A2:N" & DL).Font.Size = 12
entetes.Column = Application.Transpose(sh.Range("A1:N1").Value)
tbase = sh.Range("A2:N" & DL).Value
Dim tbl: ReDim tbl(1 To UBound(tbase), 1 To 12)
Coll = 0
For Each K In Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14)
Coll = Coll + 1
For I = 1 To UBound(tbase): tbl(I, Coll) = tbase(I, K): Next I
Next K
Coll = 2
For I = 1 To UBound(tbase): tbl(I, Coll) = Format(CDate(tbase(I, 2)), "mmm yy"): Next I
ListBox2.List = tbl
End Sub
Private Sub TextBox1_Change()
Dim T(), I&, A&, C&
With TextBox1
If .Value = "" Then ListBox2.List = tbase: Exit Sub
For I = 1 To UBound(tbase)
If tbase(I, 1) Like .Value & "*" Then
A = A + 1: ReDim Preserve T(1 To 14, 1 To A)
For C = 1 To 13: T(C, A) = tbase(I, C): Next
T(14, A) = tbase(I, 14)
End If
Next
If A > 0 Then
If A = 1 Then
ListBox2.Column = Application.Transpose(T)
Else
ListBox2.List = Application.Transpose(T)
End If
Else: ListBox2.Clear
End If
End With
End Sub