Private Sub CommandButton1_Click()
Dim NomFeuille As String
Dim ligne, nbpers, ligne_vlookup As Integer 'ligne_vlookup est utilisée pour les lignes concernant la rechercheV
ligne = 20
NomFeuille = InputBox("quel est le nom de la feuille à mettre à jour ?")
Sheets(NomFeuille).Select
nbpers = InputBox("combien de personne travail sur le projet")
'remplissage de la colonne used
ActiveSheet.Range("D" & ligne, "F" & ligne + 13).Select
Selection.ClearContents
ligne_vlookup = 8
ActiveSheet.Range("D" & ligne).Select
For i = 1 To nbpers
ActiveCell.Value = ActiveCell.Value + "=VLOOKUP(RC[-3],'Estimation détaillée'!R[" & ligne_vlookup & "]C[1]:R[" & ligne_vlookup + 13 & "]C[4],4,FALSE)"
ligne_vlookup = ligne_vlookup + 18
'MsgBox ligne_vlookup
Next
ActiveSheet.Range("D" & ligne).Select
Selection.AutoFill Destination:=ActiveSheet.Range("D" & ligne, "D" & ligne + 13), Type:=xlFillDefault
ActiveSheet.Range("D20").Select
'
'remplissage de la colonne raf
ligne_vlookup = 8
ActiveSheet.Range("E" & ligne).Select
For i = 1 To nbpers
ActiveCell.Value = ActiveCell.Value + "=VLOOKUP(RC[-4],'Estimation détaillée'!R" & ligne_vlookup & "C1:R" & ligne_vlookup + 13 & "C4,3,FALSE)"
ligne_vlookup = ligne_vlookup + 18
Next
ActiveSheet.Range("E" & ligne).Select
Selection.AutoFill Destination:=ActiveSheet.Range("E" & ligne, "E" & ligne + 13), Type:=xlFillDefault
'
end sub