Copy data from one table to another

Diving_Dan

Board Regular
Joined
Oct 20, 2019
Messages
161
Hi all,

This has been frustrating me all afternoon that I can't either sort this out myself or find the answer I am looking for online. So here goes;

I have a table called "Table1" on a worksheet called "Weigh in Data". Data is put into this table via a userform. I have a second table called "Table4" on a worksheet called "Weigh In Master".

Table1 gets filled and emptied periodically and all of the data within that table needs to be copied into table4 on the sheet "Weigh In Master" which will hold all of the records input.

If anyone can help me with the code to copy the data that will be brilliant.

Thanks in advence

Dan
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi Dan
This should do it, just change the sheet names and references

VBA Code:
Sub CopyTable()

    Sheet1.Range("Table1").Copy Sheet2.Range("A" & Sheet2.Range("A1").End(xlDown).Row + 1)
    Sheet1.Range("Table1").ClearContents

End Sub
 
Upvote 0
Thanks for that, works almost perfectly. How do I amend this to only paste the values, I know I need to have .PasteSpecial Paste:=xlPasteValues in there somewhere but not sure where.
 
Upvote 0
VBA Code:
Sub CopyTable()

    Sheet1.Range("Table1").Copy
    Sheet2.Range("A" & Sheet2.Range("A1").End(xlDown).Row + 1).PasteSpecial Paste:=xlPasteValues
    Sheet1.Range("Table1").ClearContents

End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,419
Messages
6,119,389
Members
448,891
Latest member
tpierce

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