macro record it doeosn't paste on the next row

adelvoira

New Member
Joined
Sep 9, 2017
Messages
35
Hello,
Hi, how to copy data from one sheet to a table on an other sheet using macro records , i faced a problem when i click the button it's working good but if i try to add other data it's overwrite the first one(it doesn't copy the data on the next row).
thank you in advance

This is the code:

Sub Calculer()
'
' Calculer Macro
'
'
Range("D4").Select
Selection.Copy
Sheets("Recapitulatif").Select
Range("Table1[Date]").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1").Select
Sheets("Calculette").Select
Range("D7").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(4, 5).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Recapitulatif").Select
Sheets("Calculette").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Recapitulatif").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 10).Range("A1").Select
Sheets("Calculette").Select
Range("I10").Select
Application.CutCopyMode = False
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("D7").Select
Selection.ClearContents
Range("D4").Select
Selection.ClearContents
End Sub
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
With Range("Table1[Date]").Select you select the first cell.
You need to insert a new row:
ActiveSheet.ListObjects("Table1").ListRows.Add(AlwaysInsert:=True, Position:=ActiveSheet.ListObjects("Table1").ListRows.Count + 1)
Then you can fill the new row:
Range("A" & ActiveSheet.ListObjects("Table1").ListRows.Count + 1).Select

Tip
Combine select and selection:
Range("D4").ClearContents
Sheets("Calculette").Range("D7").Copy

 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top