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
| Private Sub UserForm_Initialize()
Dim c As Range
Dim tablo()
Dim i As Integer, j As Integer
Dim temp As String
Dim present As Boolean
Dim Plage As Range
ReDim tablo(1 To 1)
tablo(1) = Cells(3, 3)
With Sheets("Feuil1")
For i = 2 To 10 Step 2
If Plage Is Nothing Then
Set Plage = .Range("B8:B" & Range("b65536").Offset(, i - 2).End(xlUp).Row).Offset(, i - 2)
Else
Set Plage = Union(Plage, .Range("B8:B" & Range("b65536").Offset(, i - 2).End(xlUp).Row).Offset(, i - 2))
End If
Next i
End With
Plage.Select
For Each c In Plage
present = False
For i = 1 To UBound(tablo)
If tablo(i) = c Then present = True
Next i
If Not present Then
ReDim Preserve tablo(1 To UBound(tablo) + 1)
tablo(UBound(tablo)) = c
End If
For i = 1 To UBound(tablo)
For j = 1 To UBound(tablo)
If tablo(i) < tablo(j) Then
temp = tablo(i)
tablo(i) = tablo(j)
tablo(j) = temp
End If
Next j
Next i
Next c
ListBox1.List = tablo
End Sub |
Partager