Bonjour,
Effectivement une petite erreur s'est glissée dans une ligne
voici le correctif
Sub Recup_Donnees()
Dim f1 As Worksheet, f2 As Worksheet
Dim i As Long, DerLig_f1 As Long, DerLig_f2 As Long
Dim x As Long, DerCol_f1 As Long, DerCol_f2 As Long, Nb_Valeurs As Long
Dim Ref_f1
Application.ScreenUpdating = False
RecuperationDonnees = True
Set f1 = Sheets("Réceptions")
Set f2 = Sheets("Stock")
DerLig_f1 = f1.Range("A" & Rows.Count).End(xlUp).Row
DerLig_f2 = f2.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To DerLig_f1
Ref_f1 = f1.Cells(i, "C")
Nb_Valeurs = f1.Cells(i, "E")
DerCol_f1 = Nb_Valeurs + 5
If DerCol_f1 > 6 Then
On Error Resume Next
x = Application.Match(Ref_f1, f2.Range(f2.Cells(1, "A"), f2.Cells(DerLig_f2, "A")), 0)
If Err.Number = 0 Then
DerCol_f2 = f2.Cells(i, "R").End(xlToLeft).Column
Range(f2.Cells(x, DerCol_f2 + 1), f2.Cells(x, DerCol_f2 + Nb_Valeurs)).Value = Range(f1.Cells(i, "F"), f1.Cells(i, DerCol_f1)).Value
End If
On Error GoTo 0
End If
Next i
RecuperationDonnees = False
Set f1 = Nothing
Set f2 = Nothing
End Sub
l'erreur est ici
DerCol_f2 = f2.Cells(2, "R").End(xlToLeft).Column
il fallait remplacer le 2 par i
Cdlt