Dim flag As Boolean 'mémorise la variable
Private Sub Worksheet_Change(ByVal Target As Range)
ListBox1.ListFillRange = "Liste"
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, [E12]) Is Nothing Then Exit Sub
Dim test As Boolean, a, b, i&
Cancel = True
test = IsEmpty([E12])
If TypeName([Liste]) = "Range" Then
a = [Liste].Resize(, 2) 'matrice, plus rapide, au moins 2 éléments
ReDim b(1 To UBound(a))
For i = 1 To UBound(a): b(i) = a(i, 1): Next 'transposition
End If
If test And IsArray(b) Then [E12] = Join(b) Else [E12] = ""
flag = True 'bloque ListBox1_Change
With ListBox1
For i = 0 To .ListCount - 1
.Selected(i) = test
Next
End With
flag = False
End Sub
Private Sub ListBox1_Change()
If flag Then Exit Sub
Dim i&, a(), n&
With ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then ReDim Preserve a(n): a(n) = .List(i, 0): n = n + 1
Next
End With
[E12] = Join(a)
End Sub