Bonjour Guillaune, Papaye, le Forum
Papaye, j'ai eu du mal a interpréter ton code et j'ai bien peur que Guillaume se perdre un peu vu qu'il dit être d'un trés faible niveau en vba.
Je propose une démo sans fichier joint...
Matériel
Un Classeur Vierge avec deux Feuilles au minimum "Feuil1" et Feuil2"
Un Userform avec une ListBox "ListBox1" et un CommanButton "CommandButton1"
Dans la Feuil1 on remplit de "A1" en "A10" (ou "A20" çà n'a pas d'importance) des "Toto1", "Toto2", "Toto2", "Toto3", "Toto4", "Toto5", etc...)
Dans le Private Module du Userform on copie/colle ce code :
Option Explicit
Private Sub UserForm_Initialize()
Dim L As Integer, i As Integer
Dim WS As Worksheet
Set WS = Sheets("Feuil1")
L = WS.Range("A65536").End(xlUp).Row
With Me.ListBox1
For i = 1 To L
.AddItem WS.Cells(i, 1)
Next
.MultiSelect = fmMultiSelectMulti
End With
End Sub
Private Sub CommandButton1_Click()
Dim L As Integer, i As Integer
Dim WS As Worksheet
Set WS = Sheets("Feuil2")
L = WS.Range("A65536").End(xlUp).Row
If L < 27 Then L = 27
If L > 40 Then MsgBox "Capacité Dépassée": Exit Sub
For i = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) = True Then
WS.Cells(L, 1) = Me.ListBox1.List(i)
L = L + 1
End If
Next
End Sub
Ce code devrait faire ce que souhaite Guillaume, si j'ai bien compris....
Bonne Fin d'Aprèm
@+Thierry