Private Sub ComboBox1_Change()
If ComboBox1.ListIndex = -1 Then lbNid.Caption = "" Else lbNid.Caption = ComboBox1.List(ComboBox1.ListIndex, 1)
End Sub
Private Sub UserForm_Initialize()
ComboBox1.ColumnCount = 2
Label1.Width = ComboBox1.Width / 2: Label2.Width = ComboBox1.Width / 2
Label1.Left = ComboBox1.Left + 5: Label2.Left = Label1.Left + Label1.Width
lbNid.Left = Label2.Left: lbNid.Caption = ""
lbNid.Width = Label2.Width - 30: lbNid.BackColor = ComboBox1.BackColor
ComboBox1.List = CreerListe(Sheets("bagues").Range("b6:u25"))
End Sub
Function CreerListe(xplage As Range)
Dim t, i&, j&, n&
t = xplage.Value
ReDim v(1 To UBound(t) / 2 * UBound(t, 2), 1 To 2)
For i = 1 To UBound(t) Step 2
For j = 1 To UBound(t)
n = n + 1
v(n, 1) = Format(t(i, j), "000")
v(n, 2) = t(i + 1, j)
Next j
Next i
CreerListe = v
End Function