Dim ColVisu(), LargeurCol(), Rng
Private Sub UserForm_Initialize()
Set f = Sheets("bd")
Set Rng = f.Range("A2:AG" & f.[A65000].End(xlUp).Row) ' Adapter
ColVisu = Array(1, 3, 10, 11, 33) ' Adapter
LargeurCol = Array(100, 50, 100, 100, 100) ' Adapter
Me.ListBox1.ColumnCount = UBound(ColVisu) + 1
Me.ListBox1.ColumnWidths = Join(LargeurCol, ";")
Me.ListBox1.List = Application.Index(Rng, Evaluate("Row(1:" & Rng.Rows.Count & ")"), ColVisu)
EnteteListBox
End Sub
Sub EnteteListBox()
i = 0
x = Me.ListBox1.Left + 8
Y = Me.ListBox1.Top - 12
For Each c In ColVisu
i = i + 1
Me("label" & i).Caption = Rng.Offset(-1).Item(1, c)
Me("label" & i).Top = Y
Me("label" & i).Left = x
Me("label" & i).Height = 24
Me("label" & i).Width = LargeurCol(i - 1)
x = x + LargeurCol(i - 1)
Next
End Sub