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
| Private Sub UserForm_Activate()
Dim C As Range, Plage As Range, LargeurListb As Integer, LargeurCols As String
With Sheets("Saisie")
Set Plage = .Range("A2", .Cells(.Rows.Count, 1).End(xlUp))
Plage.Resize(, 5).EntireColumn.AutoFit
LargeurListb = Plage.Resize(, 5).Width
Me.ListBox1.Width = LargeurListb + 20
End With
With Me.ListBox1
.Clear
For Each C In Plage.Resize(1, 5)
LargeurCols = LargeurCols & ";" & C.Width
Next C
LargeurCols = Right(LargeurCols, Len(LargeurCols) - 1)
.ColumnWidths = LargeurCols
For Each C In Plage
.AddItem C.Value
.List(.ListCount - 1, 1) = C.Offset(, 1)
.List(.ListCount - 1, 2) = C.Offset(, 2)
.List(.ListCount - 1, 3) = C.Offset(, 3)
.List(.ListCount - 1, 4) = C.Offset(, 4)
Me.ComboBox1.AddItem Format(DateValue(C.Offset(, 4)), "dd/mm/yyyy")
Next C
End With
End Sub |
Partager