re
Fais ceci dans l'USF2 :
1. remplace le code Private Sub CommandButton2_Click() par celui ci-dessous
Private Sub CommandButton2_Click()
Dim cel As Range
Dim prem
Dim n As Byte
n = 0
If TextBox1 <> "" Then
refln = 1
Set cel = Range("E:E").Find(TextBox1.Value, LookIn:=xlValues, LookAt:=xlPart)
If Not cel Is Nothing Then
prem = cel.Address
Do
If refln = ListBox1.ListIndex + 1 Then refln = cel.Row: Exit Do
refln = refln + 1
Set cel = Range("E:E").FindNext(cel)
Loop While Not cel Is Nothing And cel.Address <> prem
End If
Else: refln = ListBox1.ListIndex + 2
End If
If IsNull(ListBox1.Value) = True Then MsgBox "vous devez selectionner une reference": Exit Sub
lgn = IIf(fb.Range("A" & Rows.Count).End(xlUp).Row = 10, 11, fb.Range("A" & Rows.Count).End(xlUp)(3).Row)
n = fb.Range("A" & lgn - 2) + 1
fb.Range("A" & lgn) = n
For j = 1 To 4
colM = Choose(j, 1, 3, 5, 14)
colB = Choose(j, 2, 3, 12, 17)
fb.Cells(lgn, colB).Value = fm.Cells(refln, colM).Value
Next j
fb.Select
Unload Me
End Sub
2. en entête de l'USF2, supprimer les deux déclarations --> n& et t&
Cordialement