Sub Copier_Les_Ingrédients2()
'Affiche dans la feuille "RecapIng", les ingrédients nécessaires pour chaque recette
nCol = 3
ReDim oRcp(1 To nCol, 1 To 1)
Derlig = Sheets("RecapIng").Range("A" & Sheets("RecapIng").Rows.Count).End(xlUp).Row + 1
If Derlig = 2 Then Derlig = 1
'Parcourt les 2 premières recettes : à adapter (boucle for each)
For K = 1 To 2
With Sheets(K)
nLig = 0: Derlig1 = .Range("A" & .Rows.Count).End(xlUp).Row
'boucle pour supprimer les espaces superflus dans les cellules vides
'On ne sait jamais!!!
For Each Cell In .Range("A1:A" & Derlig1)
If InStr(1, Cell.Value, Chr(32)) Then Cell.Value = Trim(Cell)
Next
'Recherche dans la colonne A la chaine de caractères "Marchandise"
Set c = .Columns(1).Find("Marchandise", LookIn:=xlValues, lookat:=xlWhole)
'Recherche dans la colonne A la chaine de caractères "Notes :"
Set c1 = .Columns(1).Find("Notes :", LookIn:=xlValues, lookat:=xlWhole)
If Not c Is Nothing And Not c1 Is Nothing Then
Zone = .Range("A" & c.Row & ":C" & c1.Row)
If UBound(Zone, 1) > 2 Then
X = Application.CountBlank(.Range("A" & c.Row & ":A" & c1.Row))
If UBound(Zone, 1) > X + 2 Then
For i = 2 To UBound(Zone, 1) - 1
If Not IsEmpty(Zone(i, 1)) Then
nLig = nLig + 1
ReDim Preserve oRcp(1 To nCol, 1 To nLig)
For j = 1 To nCol
oRcp(j, nLig) = Zone(i, j)
Next j
End If
Next i
Sheets("RecapIng").Range("A" & Derlig).Resize(nLig, 1) = .Range("A1")
Sheets("RecapIng").Range("B" & Derlig).Resize(nLig, nCol) = WorksheetFunction.Transpose(oRcp)
End If
End If
End If
Derlig = Sheets("RecapIng").Range("A" & Sheets("RecapIng").Rows.Count).End(xlUp).Row + 1
End With
Next K
End Sub