Hi, i record a new macro but i faced a problem when i click the button to copy a cell value in the first row from sheet "Marge Carburants" to sheet "recapitulatif"
it's copy just the first row and didn't jum to the next cell when i click the button to add an other row in sheet "recapitulatif"
here is my code
it's copy just the first row and didn't jum to the next cell when i click the button to add an other row in sheet "recapitulatif"
here is my code
Code:
Sub Calculer()
'
' Calculer Macro
' Paste to Recapitulatif
'
'
Range("D4").Select
Selection.Copy
Sheets("Recapitulatif").Select
lastrow = Range("a" & Rows.Count).End(xlUp).Row
Range("a" & lastrow + 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1").Select
Sheets("Calculette").Select
Range("D7").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Sheets("Recapitulatif").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1").Select
Sheets("Calculette").Select
Range("I11").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Recapitulatif").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1").Select
Sheets("Calculette").Select
Range("M12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Recapitulatif").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1").Select
Sheets("Marge Carburants").Select
ActiveCell.Offset(0, -15).Range("A1").Select
Sheets("Marge produit autre").Select
ActiveCell.Offset(0, -8).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Recapitulatif").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1").Select
Sheets("Calculette").Select
Range("D9").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Recapitulatif").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1").Select
Sheets("Calculette").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Calculette").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Recapitulatif").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1").Select
Sheets("Marge Carburants").Select
ActiveWindow.ScrollColumn = 2
ActiveCell.Offset(0, 15).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Marge Carburants").Select
Range("Q7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Recapitulatif").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1").Select
Sheets("Marge produit autre").Select
Range("J7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Recapitulatif").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1").Select
Sheets("Calculette").Select
Range("D11").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Recapitulatif").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
Sheets("Calculette").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("D10").Select
Selection.ClearContents
Range("D9").Select
Selection.ClearContents
Range("D7").Select
Selection.ClearContents
Range("D4").Select
Selection.ClearContents
Range("I10").Select
Selection.ClearContents
Range("H9").Select
Selection.ClearContents
Range("H8").Select
Selection.ClearContents
Range("H7").Select
Selection.ClearContents
Range("H6").Select
Selection.ClearContents
Range("H5").Select
Selection.ClearContents
Range("L11").Select
Selection.ClearContents
Range("L10").Select
Selection.ClearContents
Range("L9").Select
Selection.ClearContents
Range("L8").Select
Selection.ClearContents
Range("L7").Select
Selection.ClearContents
Range("L6").Select
Selection.ClearContents
Range("L5").Select
Selection.ClearContents
End Sub