Private Sub LV_Init(ByRef LV As ListView)
'configuration
With LV
.View = lvwReport
.FullRowSelect = True
.Gridlines = True
End With
'mise en place de l'entete
With LV.ColumnHeaders
.Clear
.Add , , "Index", 30
.Add , , "Zone", 30
.Add , , "Valeur", 30
.Add , , "Cellule", 40
.Add , , "Feuille", 120
End With
End Sub
Private Sub LV_Vider(ByRef LV As ListView)
LV.ListItems.Clear
End Sub
Private Sub LV_Remplir(ByRef LV As ListView, ByRef Liste)
'macro qui remplit les ListeView
Dim nb As Long, i As Long
Dim Num_Zone_Maxi As Integer, Num_Zone_Format As String
Dim Index_Maxi As Integer, Index_Format As String
With LV
nb = UBound(Liste)
'récuperation des formats
Num_Zone_Maxi = 0
Index_Maxi = 0
For i = 1 To nb
If Liste(i).Num_Zone > Num_Zone_Maxi Then Num_Zone_Maxi = Liste(i).Num_Zone
Next i
Index_Maxi = Len(CStr(nb))
Index_Format = String(Index_Maxi, "0")
Num_Zone_Maxi = Len(CStr(Num_Zone_Maxi))
Num_Zone_Format = String(Num_Zone_Maxi, "0")
'affichage des éléments
For i = 1 To nb
.ListItems.Add i, , Format(i, Index_Format)
.ListItems(i).ListSubItems.Add , , Format(Liste(i).Num_Zone, Num_Zone_Format)
.ListItems(i).ListSubItems.Add , , Liste(i).Valeur
.ListItems(i).ListSubItems.Add , , Liste(i).Cellule
.ListItems(i).ListSubItems.Add , , Liste(i).Folio
Next i
End With
End Sub