Code to copy

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,392
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Could I get some help to write some code to copy from one table to another please?

I have the following code I tried to write but because I am still learning to code, I don't know how to debug it.


Code:
        Set tbl = Worksheets("NPSS_quote_sheet").ListObjects("npss_quote")
       For Each tblrow In tbl.ListRows
                
            Set wsDst = Workbooks("costing tool").Worksheets("home")
                With wsDst
                    tblrow.Range.Resize(, 2).Copy
                    .Range(workbooks("costing tool").worksheets("home").listobjects("tblCosting) A & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValuesAndNumberFormats
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Re: help with code to copy

I had a look at those sites but couldn't see what I wanted. I basically want to copy x number of table rows in one table to another table in another workbook. I think I could work out how to do that but it isn't just a straight copy and paste, such as the first 4 columns in one table going to the first 4 columns in another table. I can't quite remember the positioning of the columns, I have it written in an earlier post. It was something like column A of one table to column A of the other. Then it was something like column B of the first table to column F of the second table.

I also didn't know how to have some information that is entered above the table to be the same for every record in the table. For instance, the child name might be entered above and it needs to be the same for each table record.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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