Bonjour le forum
j'ai essayer d adapter un code (merci Leforestier) sur une liste multiselection.
ce nouveau code , aprés une ou plusieurs selection de communes, va chercher toutes les lignes conceernées par les communes dans la sheets BD.[G:W] et va les coller dans la sheets lievre derniere ligne vide [A:J] .
voici ce que j'ai fait mais j ai une erreur "impossible de lire la propriété list argument non valide. argument non valide". Pouvez vous m aider? merci d avance.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
 
Private Sub Annuler_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
 
'multiselection
Me.LB_CommuneMultiSelect.MultiSelect = fmMultiSelectMulti
  Set f = Sheets("BD")
  'choix de liste
    Set mondico = CreateObject("Scripting.Dictionary")
        For Each c In f.Range("j2", f.[J65000].End(xlUp))
 
        'sans doublon
          If Not mondico.Exists(c.Value) Then mondico.Add c.Value, c.Value
    Next c
 
  Me.LB_CommuneMultiSelect.List = mondico.items
 
  'tri par orde alphabetique comunne
  With LB_CommuneMultiSelect
    For i = 0 To .ListCount - 1
        For j = 0 To .ListCount - 1
            If UCase(.List(i)) < UCase(.List(j)) Then
                temp = .List(j)
                .List(j) = .List(i)
                .List(i) = temp
            End If
        Next j
    Next i
End With
 
End Sub
 
Private Sub validezCommune_Click()
Dim DerLig As Long, Lig As Long
Dim WkBD As Worksheet
Dim i As Integer
    Set WkBD = Sheets("BD")
    With Sheets("Lievre")
        DerLig = .Range("A65536").End(xlUp).Row + 1
        For i = 0 To LB_CommuneMultiSelect.ListCount - 1
            If LB_CommuneMultiSelect.Selected(i) Then
                Lig = LB_CommuneMultiSelect.List(i, 1)
                WkBD.Range("G" & Lig & ":W" & Lig).Copy .Cells(DerLig, 1)
                DerLig = DerLig + 1
            End If
        Next i
    End With
End Sub