Private Sub UserForm_Initialize()
Dim i As Long, sNom As String
Sheets("Feuil1").AutoFilterMode = False
With ListView1
With .ColumnHeaders
.Clear
.Add , , "Nom", 120
.Add , , "Parenté", 50
.Add , , "TEST", 40
End With
.View = lvwReport
.FullRowSelect = True
.Gridlines = True
Application.ScreenUpdating = False
Sheets("Feuil1").Select
i = Sheets("Feuil1").Range("A65536").End(xlUp).Row
Sheets("Feuil1").Range("A1:BM" & i).Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Sheets("Feuil1").Cells(1, 1).Select
sNom = ""
For i = 3 To Sheets("Feuil1").Range("A65536").End(xlUp).Row
If Sheets("Feuil1").Cells(i, 1) <> sNom Then
.ListItems.Add , , Sheets("Feuil1").Cells(i, 1)
.ListItems(.ListItems.Count).ListSubItems.Add , , Sheets("Feuil1").Cells(i, 3)
.ListItems(.ListItems.Count).ListSubItems.Add , , Sheets("Feuil1").Cells(i, 2)
sNom = Sheets("Feuil1").Cells(i, 1)
End If
Next
ListView1.ListItems(1).Selected = False
Set ListView1.SelectedItem = Nothing
End With
Sheets("Accueil").Select
Application.ScreenUpdating = True
End Sub
Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
Application.ScreenUpdating = False
ListView1.Sorted = False
ListView1.SortKey = ColumnHeader.Index - 1
If ListView1.SortOrder = lvwAscending Then
ListView1.SortOrder = lvwDescending
Else
ListView1.SortOrder = lvwAscending
End If
ListView1.Sorted = True
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton1_Click()
Unload Me: Sheets(1).Activate
End Sub