Sub remplissage_val_conso()
Dim reference As String
Dim surfacetotale As Single, coefmatiere As Single
Dim nbmatiere1 As Integer, nbmatiere2 As Integer, cpt1 As Integer, ligne As Integer, colonne As Integer, lig As Integer, col As Integer
Dim c As Range
cpt1 = 0
ligne = 2
colonne = 2
'trouve le nombre de matière
nbmatiere1 = Sheets("coef matière").Cells(1, Application.Columns.Count).End(xlToLeft).Column - 3
nbmatiere2 = Sheets("consommation").Cells(Application.Rows.Count, 1).End(xlUp).Row - 1
'trouve la reference et la surface de production, statique pour l'instant mais se modifiera a l'avenir pour pouvoir faire toutes les productions
reference = Sheets("planning informatique").Cells(306, 10)
surfacetotale = Sheets("planning informatique").Cells(306, 15)
'trouve la ligne de la référence dans le fichier coef matière
Set c = Sheets("coef matière").[A:A].Find(reference, LookIn:=xlValues)
If Not c Is Nothing Then
lig = c.Row
col = c.Column
col = col + 3
'boucle pour écrire dans la feuille valeur de conso(feuille tampon)
Do While cpt1 < nbmatiere
coefmatiere = Sheets("coef matière").Cells(lig, col)
Sheets("valeur de conso").Cells(ligne, colonne).Value = coefmatiere
cpt1 = cpt1 + 1
ligne = ligne + 1
col = col + 1
Loop
End If
End Sub