Sub cartman()
'ligne et colonne du tableau pour chaque client
l = 1
c = 1
'boucle sur les client
For i = 1 To 16
Cells(l, c) = "client"
Cells(l, c + 1) = "client" & i
'récupéré les valeurs du premier tableau
'on parcour le tableau 40
Sheets("Synthèse").Select
Cells(l + 3 + h, c) = "40M"
For y = 3 To 15
Sheets("40").Select
If Cells(y, i + 2) <> 0 Then
quantite = Cells(y, i + 2)
variete = Cells(y, 1)
code = Cells(y, 2)
Sheets("Synthèse").Select
'quantité
Cells(l + 3 + h, c + 1) = quantite
Total = Total + quantite
'variété
Cells(l + 3 + h, c + 2) = variete
'code chelou
Cells(l + 3 + h, c + 4) = code
h = h + 1
End If
Next y
'on saute une ligne
h = h + 1
'Second Tableau
Sheets("Synthèse").Select
Cells(l + 3 + h, c) = "50M"
For y = 3 To 18
Sheets("50").Select
If Cells(y, i + 2) <> 0 Then
quantite = Cells(y, i + 2)
variete = Cells(y, 1)
code = Cells(y, 2)
Sheets("Synthèse").Select
'quantité
Cells(l + 3 + h, c + 1) = quantite
Total = Total + quantite
'variété
Cells(l + 3 + h, c + 2) = variete
'code chelou
Cells(l + 3 + h, c + 4) = code
h = h + 1
End If
Next y
'on saute une ligne
h = h + 1
'Second Tableau
Sheets("Synthèse").Select
Cells(l + 3 + h, c) = "60M"
For y = 3 To 19
Sheets("60").Select
If Cells(y, i + 2) <> 0 Then
quantite = Cells(y, i + 2)
variete = Cells(y, 1)
code = Cells(y, 2)
Sheets("Synthèse").Select
'quantité
Cells(l + 3 + h, c + 1) = quantite
Total = Total + quantite
'variété
Cells(l + 3 + h, c + 2) = variete
'code chelou
Cells(l + 3 + h, c + 4) = code
h = h + 1
End If
Next y
'on affiche le total
Sheets("Synthèse").Select
Cells(l + 3 + h + 2, c) = "total"
Cells(l + 3 + h + 2, c + 1) = Total
'on change de client on va sur un nouveau tableau
Total = 0
h = 0
c = c + 7
Next i
End Sub