1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Private Sub UserForm_Initialize()
ListBox2.ColumnCount = 3
ListBox2.Clear
For i = 1 To Sheets(1).Range("a65536").End(xlUp).Row
ListBox1.AddItem Sheets(1).Range("a" & i)
Next
End Sub
Private Sub ListBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If Button = 2 Then
ListBox2.Clear
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
ListBox2.AddItem ListBox1.List(i)
ListBox2.List(e, 1) = i + 1 'on met l'index de la ligne dans la colonne 2
e = e + 1
End If
Next i
End If
End Sub |