Copy data from one table to another

Diving_Dan

Board Regular
Joined
Oct 20, 2019
Messages
149
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
 

Some videos you may like

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

EFANYoutube

Board Regular
Joined
May 19, 2017
Messages
162
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
 

Diving_Dan

Board Regular
Joined
Oct 20, 2019
Messages
149
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.
 

EFANYoutube

Board Regular
Joined
May 19, 2017
Messages
162
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
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,122,530
Messages
5,596,699
Members
414,088
Latest member
rodriboraun

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
Top