Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect([M2:M100], Target) Is Nothing And Target.Count = 1 Then
Me.ListBox1.MultiSelect = fmMultiSelectMulti
Me.ListBox1.List = Sheets("donnée").Range("A2:A22").Value
a = Split(Trim(Target), "-")
If UBound(a) >= 0 Then
For i = 0 To Me.ListBox1.ListCount - 1
If Not IsError(Application.Match(Me.ListBox1.List(i), a, 0)) Then Me.ListBox1.Selected(i) = True
Next i
End If
Me.ListBox1.Height = 300
Me.ListBox1.Width = 150
Me.ListBox1.Top = Target.Top
Me.ListBox1.Left = Target.Left + Target.Width
Me.ListBox1.Visible = True
Else
Me.ListBox1.Visible = False
End If
End Sub
Private Sub ListBox1_Change()
For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) = True Then temp = temp & Me.ListBox1.List(i) & "-"
Next i
ActiveCell = Trim(temp)
End Sub