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
| Private Sub UserForm_Initialize()
Dim Last As Long, i As Long, j As Long
Dim Tb
With Sheets("Feuil1")
Last = .Cells(.Rows.Count, "AL").End(xlUp).Row
If Last > 2 Then
Tb = .Range("AL3:AP" & Last)
With Me.ListView1
.HideColumnHeaders = False
.View = lvwReport
.AllowColumnReorder = True
.FullRowSelect = True
With .ColumnHeaders
.Clear
.Add , , "Contrat", 50
.Add , , "Nb jours", 50
.Add , , "Départ.", 50
.Add , , "Date Prod", 50
End With
For i = 1 To UBound(Tb, 1)
j = j + 1
.ListItems.Add j, , Tb(i, 1) 'Contrat
.ListItems(j).ListSubItems.Add , , Tb(i, 2) 'Nb jours
.ListItems(j).ListSubItems.Add , , Tb(i, 3) 'Produit
.ListItems(j).ListSubItems.Add , , Tb(i, 4) 'Date Prod
Next i
End With
End If
End With
End Sub |
Partager