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
| Private Sub CommandButton3_Click()
Dim Plage As Range, Est, Add As String, vLi As Integer, Vcol As Byte
Dim i As Integer
Dim temp
Dim Ok As Boolean
With ListBox1
.Clear
.ColumnCount = 6
.ColumnWidths = "120;90;20;255;80;60"
Set Plage = Range("H2:H" & [H65000].End(xlUp).Row)
Set Est = Plage.Find(False)
If Not Est Is Nothing Then
Add = Est.Address
Do
.AddItem Cells(Est.Row, 1)
For Vcol = 2 To 6
.List(vLi, Vcol - 1) = Cells(Est.Row, Vcol)
Next
vLi = vLi + 1
Set Est = Plage.FindNext(Est)
Loop While Not Est Is Nothing And Est.Address <> Add
End If
TextBox1 = .ListCount
End With
'pour trier l'affichage
Dim Lig
Dim Col
Dim clé() As String, index() As Long, a(), b()
a = Me.ListBox1.List
ReDim b(LBound(a) To UBound(a), LBound(a, 2) To UBound(a, 2))
ReDim clé(LBound(a) To UBound(a, 1))
ReDim index(LBound(a) To UBound(a, 1))
For i = LBound(a) To UBound(a, 1)
clé(i) = a(i, 0) & a(i, 1): index(i) = i
Next i
Call Tri(clé(), index(), LBound(a), UBound(clé))
For Lig = LBound(clé) To UBound(clé)
For Col = LBound(a, 2) To UBound(a, 2): b(Lig, Col) = a(index(Lig), Col): Next Col
Next Lig
Me.ListBox1.List = b
End Sub |
Partager