Dim NbCol As Byte, i As Byte
Private Sub ListBox1_Click()
For i = 1 To 4
Controls("TextBox" & i) = ListBox1.Column(i - 1)
Next i
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
With Sheets("SAISIE")
For i = 1 To 4
If i < 3 Then
.Cells(vLi, i + 1) = Controls("TextBox" & i)
Else
.Cells(vLi, i + 1) = Controls("TextBox" & i) * 1
End If
Next
End With
Unload Me
Cells(vLi + 1, 2).Select
End Sub
Private Sub UserForm_Initialize()
NbCol = [clients].CurrentRegion.Columns.Count
ListBox1.ColumnCount = NbCol
ListBox1.List = Range("clients").Resize(, NbCol).Value
End Sub
Private Sub TextBox5_Change()
Dim Plage As Range, C As Range, Premier As String, Lig As Integer, Col As Byte
ListBox1.Clear
Set Plage = [clients].Resize(, NbCol)
Set C = Plage.Find(TextBox5, , , xlPart)
If Not C Is Nothing Then
Premier = C.Address
Do
ListBox1.AddItem
Lig = C.Row - Plage.Row + 1
For Col = 1 To NbCol
ListBox1.List(i, Col - 1) = Plage.Cells(Lig, Col)
Next Col
Set C = Plage.FindNext(C)
Loop While Not C Is Nothing And C.Address <> Premier
End If
End Sub
Private Sub CommandButton2_Click()
With Sheets("SAISIE")
For i = 1 To 4
If i < 3 Then
.Cells(vLi, i + 1) = Controls("TextBox" & i)
Else
.Cells(vLi, i + 1) = Controls("TextBox" & i) * 1
End If
Next
End With
Unload Me
Cells(vLi + 1, 2).Select
End Sub
Private Sub CommandButton3_Click()
For i = 1 To 5
Controls("Textbox" & i) = ""
Next i
End Sub