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
|
st_nom_vpc.ColumnCount = 4
lst_nom_vpc.ColumnWidths = "0;50;80;50"
Dim d As Object, a, Tbl, i%, n%, cd As Boolean
Set d = CreateObject("Scripting.Dictionary")
With Worksheets("Données")
a = .Range("A2:Y" & .[D65000].End(xlUp).Row).Value
End With
For i = LBound(a) To UBound(a)
For n = 1 To 16
If a(i, n) = "" Then
cd = True: Exit For
End If
Next n
If a(i, 15) = "" Or a(i, 15) = "" Then d(i) = Array(a(i, 1), a(i, 4), a(i, 5), a(i, 6))
cd = False
Next i
n = d.Count
If n > 1 Then
Tbl = WorksheetFunction.Transpose(d.items)
Me.lst_nom_vpc.List = WorksheetFunction.Transpose(Tbl)
ElseIf n = 1 Then
Tbl = d.items
With Me.lst_nom_vpc
.AddItem Tbl(0)(0)
For i = 1 To 16
.List(0, i) = Tbl(0)(i)
Next i
End With
End If
End Sub |
Partager