Liste déroulante à choix multiple UN CHOIX PAR LIGNE RESULTAT

Coralie -  
 Coralie -
Bonjour,

Je cherche à créer une liste déroulante à choix multiple qui envoie chaque choix dans une cellule propre.

Pikaju avait posté une macro (ci dessous) qui correspond presque parfaitemente à ce que je veux faire sauf pour la ce qui est d'affecter une cellule à chaque résultat.

Je pense que c'est cette peut-être partie qu'il faut changer:
ValeurARetourner = ValeurARetourner & ListBox1.List(i) & " & "

(Sachant qu'aller à la ligne avec vbrf n'est pas ce que je cherche)

Merci d'avance à qui pourra m'aider!

Macro de Pikaju:
Private SUB
 CommandButton1_Click()

Dim i As Byte
Dim ValeurARetourner As String

For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
ValeurARetourner = ValeurARetourner & ListBox1.List(i) & " & "
End If
Next i
With Sheets("Feuil1")
.Range("C4") = Left(ValeurARetourner, Len(ValeurARetourner) - 3)
.Range("C5").Activate
End With
UserForm1.Hide
Unload UserForm1
End Sub

Private Sub UserForm_Initialize()
Dim i As Integer, Derlig As Integer
ListBox1.Clear

Derlig = Sheets("Feuil1").Cells(65536, 9).End(xlUp).Row
For i = 1 To Derlig
ListBox1.AddItem Cells(i, 9).Value
Next i
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
ListBox1.Selected(i) = False
End If
Next i
End Sub
A voir également:

2 réponses

Boisgontierjacques Messages postés 175 Date d'inscription   Statut Membre Dernière intervention   64
 
Bonjour,

Exemple:

http://boisgontierjacques.free.fr/fichiers/Formulaire/FormSelectionMult2.xls


Dim f, a(1 To 20, 1 To 2)
Sub UserForm_Initialize()
Set f = Sheets("bd")
Me.ListBox1.List = Range(f.[A2], f.[b65000].End(xlUp)).Value
Me.ListBox1.MultiSelect = fmMultiSelectMulti
End Sub

Private Sub ListBox1_Change()
ligne = 0
For k = 0 To Me.ListBox1.ListCount - 1
If Me.ListBox1.Selected(k) = True Then
ligne = ligne + 1
a(ligne, 1) = Me.ListBox1.List(k, 0)
a(ligne, 2) = Me.ListBox1.List(k, 1)
End If
Next k
End Sub

Private Sub cmdValider_Click()
f.Cells(2, "e").Resize(20, 2).ClearContents
f.Cells(2, "e").Resize(UBound(a), 2) = a
Unload Me
End Sub

Jacques Boisgontier
0
Coralie
 
Super! Merci beaucoup
0