Re,
Voilà avec une petite macro, en modifiant le N° de facture le reste s’affiche
La macro :
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("F2")) Is Nothing Then 'Sur Chgt cellule F2
Dim i%, j%, col%, NoFact$
NoFact = Cells(2, 6).Value 'N° Facture
col = Application.WorksheetFunction.Match(NoFact, Feuil4.Rows(3), 0) 'N° de la colonne
j = 18
Feuil5.Range("B18:F34").ClearContents 'Efface les données
For i = 10 To 24 'Boucle sur les produits si case non vide
If Feuil4.Cells(i, col).Value <> "" Then
Cells(j, 2) = Feuil4.Cells(i, 1)
Cells(j, 3) = Application.WorksheetFunction.Index(Feuil3.Range("B4:B18"), _
Application.WorksheetFunction.Match(Feuil5.Cells(j, 2), Feuil3.Range("A4:A18"), 0))
Cells(j, 5) = Feuil4.Cells(i, col)
Cells(j, 6) = Application.WorksheetFunction.Index(Feuil3.Range("C4:C18"), _
Application.WorksheetFunction.Match(Feuil5.Cells(j, 2), Feuil3.Range("A4:A18"), 0))
j = j + 1
End If
Next i
End If
End Sub
test (15).xlsm (44,9 Ko)
Restera à voir le calcul avec TVA
La feuille chiffre d’affaire est renseignée