Private Sub ComboBox1_Click()
With Me.ComboBox1
Me.TextBox1.Text = .List(.ListIndex, 1)
Me.TextBox2.Text = .List(.ListIndex, 2)
Me.TextBox3.Text = .List(.ListIndex, 3)
Me.TextBox4.Text = .List(.ListIndex, 4)
Me.TextBox5.Text = .List(.ListIndex, 5)
Me.TextBox6.Text = .List(.ListIndex, 6)
End With
End Sub
Private Sub Userform_Initialize()
Dim DerLgn As Long, DerCol As Byte, Ligne As Long
Dim Tableau
With Worksheets("EnregistrementFacture")
DerLgn = .Cells(.Rows.Count, 1).End(xlUp).Row
DerCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
With .Range(.Cells(1, 1), .Cells(DerLgn, DerCol))
.Sort key1:=.Cells(2, 1), Order1:=xlDescending, Header:=xlYes
Tableau = .Value
End With
End With
With Me.ComboBox1
.ColumnCount = 7
.ColumnWidths = "1;0;0;0;0;0;0"
For Ligne = 2 To UBound(Tableau, 1)
.AddItem Tableau(Ligne, 1)
.List(.ListCount - 1, 1) = Tableau(Ligne, 4) '4
.List(.ListCount - 1, 2) = Tableau(Ligne, 11) '11
.List(.ListCount - 1, 3) = Tableau(Ligne, 12) '12
.List(.ListCount - 1, 4) = Tableau(Ligne, 13) '13
.List(.ListCount - 1, 5) = Tableau(Ligne, 14) '14
.List(.ListCount - 1, 6) = Tableau(Ligne, 15) '15
Next Ligne
End With
End Sub