Private Sub CommandButton1_Click()
Dim i As Integer
Dim tbl As Variant
Dim temp As String
Dim extension As String
For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
If temp <> "" Then temp = temp & "," & Me.ListBox1.List(i) Else temp = Me.ListBox1.List(i)
End If
Next i
tbl = Range("Tableau1[#Data]").Value
For i = 1 To UBound(tbl)
extension = Right(tbl(i, 1), Len(tbl(i, 1)) - InStr(tbl(i, 1), "."))
'
' si position de extension dans temp est >0 alors on ajoute à la listbox3
If InStr(temp, "*." & extension) > 0 Then
With Me.ListBox3
.AddItem
.List(.ListCount - 1, 0) = tbl(i, 1)
.List(.ListCount - 1, 1) = tbl(i, 2)
.List(.ListCount - 1, 2) = tbl(i, 3)
End With
End If
Next
End Sub