Dim f, NbCol, NomTableau, TblBD()
Private Sub UserForm_Initialize()
NomTableau = "Tableau1"
TblBD = Range(NomTableau).Value
NbCol = UBound(TblBD, 2) ' modif
Set d = CreateObject("scripting.dictionary")
For i = LBound(TblBD) To UBound(TblBD)
d(TblBD(i, 2)) = ""
Next i
Me.ChoixListBox1.List = d.keys
EnteteListBox
End Sub
Private Sub ChoixListBox1_change()
Affiche
End Sub
Sub Affiche()
Set dchoisis1 = CreateObject("Scripting.Dictionary")
For i = 0 To Me.ChoixListBox1.ListCount - 1
If Me.ChoixListBox1.Selected(i) Then dchoisis1(Me.ChoixListBox1.List(i, 0)) = ""
Next i
n = 0: Dim Liste()
For i = LBound(TblBD) To UBound(TblBD)
tmp = TblBD(i, 2) 'modif
If (dchoisis1.exists(tmp) Or dchoisis1.Count = 0) Then
n = n + 1
ReDim Preserve Liste(1 To NbCol, 1 To n)
For k = 1 To NbCol
Liste(k, n) = TblBD(i, k)
Next k
End If
Next i
If n > 0 Then Me.ListBox1.Column = Liste Else Me.ListBox1.Clear
End Sub