Copy row from one sheet and insert copied row under last row in another sheet

atame

New Member
Joined
May 26, 2015
Messages
31
I am in need of your expert assistance.
I am trying to write some code that will copy rows and insert the copied row below the last row in another sheet.
I have a Global sheet that has the data i will be copying. It will need to look in column Q.
I think the problem will be when trying to copy the data, the data in column G is the text name of a Contract Code. But the sheets are name with the Number version.
for example i have a row that has BRREPAIRS in column Q, I need this to copy to Sheet 2870, then i have a row that has BRVOIDS in column Q, I need this to copy to Sheet 2781.
I could have multiple different Contract names so i think i might need to define the text to equal a sheet. So maybe <code style="margin: 0px; padding: 1px 5px; border: 0px; font-size: 13px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: pre-wrap; background-color: rgb(238, 238, 238);">Set BRVOIDS = Sheet.name("2781")</code> <code style="margin: 0px; padding: 1px 5px; border: 0px; font-size: 13px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: pre-wrap; background-color: rgb(238, 238, 238);">Set BRREPAIRS = Sheet.name("2780")</code> and so on until all sheets are defined.
When the data gets copied i need it to find the last row in column a that has data, when it is found it will insert the copied row into the sheet. for example <code style="margin: 0px; padding: 1px 5px; border: 0px; font-size: 13px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: pre-wrap; background-color: rgb(238, 238, 238);">EntireRow.Insert Shift:=xlDown</code>.
I dont have any code at the moment. I would really appreciate all the assistance.

This is an example of the source data.
[TABLE="width: 1293"]
<tbody>[TR]
[TD]1[/TD]
[TD]12345[/TD]
[TD]54321[/TD]
[TD]12 hello[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD] $ 2.00[/TD]
[TD] $ 12.00[/TD]
[TD][/TD]
[TD] $ 12.00[/TD]
[TD]2780[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[TD]NA-COG[/TD]
[TD]BRREPAIRS[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]98765[/TD]
[TD]56789[/TD]
[TD]98 hello[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD] $ 8.00[/TD]
[TD] $ 98.00[/TD]
[TD][/TD]
[TD] $ 98.00[/TD]
[TD]2781[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[TD]ERROR[/TD]
[TD]BRVOIDS[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]23456[/TD]
[TD]65432[/TD]
[TD]23 hello[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD] $ 3.00[/TD]
[TD] $ 23.00[/TD]
[TD][/TD]
[TD] $ 23.00[/TD]
[TD]2780[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[TD]C1-COG[/TD]
[TD]BRREPAIRS[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]87654[/TD]
[TD]45678[/TD]
[TD]87 hello[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD] $ 7.00[/TD]
[TD] $ 87.00[/TD]
[TD][/TD]
[TD] $ 87.00[/TD]
[TD]2781[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[TD]C1-COG[/TD]
[TD]BRVOIDS[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]34567[/TD]
[TD]76543[/TD]
[TD]34 hello[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD] $ 4.00[/TD]
[TD] $ 34.00[/TD]
[TD][/TD]
[TD] $ 34.00[/TD]
[TD]2780[/TD]
[TD][/TD]
[TD="align: right"]0[/TD]
[TD]CANCELLED[/TD]
[TD]BRREPAIRS[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]76543[/TD]
[TD]34567[/TD]
[TD]76 hello[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD] $ 6.00[/TD]
[TD] $ 76.00[/TD]
[TD][/TD]
[TD] $ 76.00[/TD]
[TD]2781[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[TD]NA-COG[/TD]
[TD]BRVOIDS[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]45678[/TD]
[TD]87654[/TD]
[TD]45 hello[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD] $ 5.00[/TD]
[TD] $ 45.00[/TD]
[TD][/TD]
[TD] $ 45.00[/TD]
[TD]2780[/TD]
[TD][/TD]
[TD="align: right"]100[/TD]
[TD]ERROR[/TD]
[TD]BRREPAIRS[/TD]
[/TR]
</tbody>[/TABLE]


Here is where it needs to be inserted.
[TABLE="width: 1092"]
<tbody>[TR]
[TD]1[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]1 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 12.00[/TD]
[TD] £ 984.50[/TD]
[TD][/TD]
[TD] £ 984.50[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]38[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]2 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 91.00[/TD]
[TD] £ 984.51[/TD]
[TD][/TD]
[TD] £ 984.51[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]39[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]3 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.52[/TD]
[TD][/TD]
[TD] £ 984.52[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]40[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]3 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.52[/TD]
[TD][/TD]
[TD] £ 984.52[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]41[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]4 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.53[/TD]
[TD][/TD]
[TD] £ 984.53[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]41[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]5 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.54[/TD]
[TD][/TD]
[TD] £ 984.54[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]41[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]6 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.55[/TD]
[TD][/TD]
[TD] £ 984.55[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]41[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]7 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 13.00[/TD]
[TD] £ 984.56[/TD]
[TD][/TD]
[TD] £ 984.56[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]41[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]8 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.57[/TD]
[TD][/TD]
[TD] £ 984.57[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]45[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]9 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 45.50[/TD]
[TD] £ 984.58[/TD]
[TD][/TD]
[TD] £ 984.58[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]47[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]10 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 364.00[/TD]
[TD] £ 984.59[/TD]
[TD][/TD]
[TD] £ 984.59[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]47[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]11 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.60[/TD]
[TD][/TD]
[TD] £ 984.60[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]50[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]12 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.61[/TD]
[TD][/TD]
[TD] £ 984.61[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]50[/TD]
[TD]sheet2[/TD]
[TD]17872[/TD]
[TD="colspan: 3"]13 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.62[/TD]
[TD][/TD]
[TD] £ 984.62[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]50[/TD]
[TD]sheet2[/TD]
[TD]17873[/TD]
[TD="colspan: 3"]14 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.62[/TD]
[TD][/TD]
[TD] £ 984.62[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]50[/TD]
[TD]sheet2[/TD]
[TD]17874[/TD]
[TD="colspan: 3"]15 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.62[/TD]
[TD][/TD]
[TD] £ 984.62[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]50[/TD]
[TD]sheet2[/TD]
[TD]17875[/TD]
[TD="colspan: 3"]16 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.62[/TD]
[TD][/TD]
[TD] £ 984.62[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]50[/TD]
[TD]sheet2[/TD]
[TD]17876[/TD]
[TD="colspan: 3"]17 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.62[/TD]
[TD][/TD]
[TD] £ 984.62[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]50[/TD]
[TD]sheet2[/TD]
[TD]17877[/TD]
[TD="colspan: 3"]18 Fake House, Fake Road, FK1 1FK[/TD]
[TD][/TD]
[TD][/TD]
[TD] £ 65.00[/TD]
[TD] £ 984.62[/TD]
[TD][/TD]
[TD] £ 984.62[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]inserted[/TD]
[TD]here[/TD]
[TD]the first blank row[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Cumulative:[/TD]
[TD="align: right"]£1,435.50[/TD]
[TD="align: right"]£18,706.90[/TD]
[TD="align: right"]£0.00[/TD]
[TD="align: right"]£18,706.90[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Movement:[/TD]
[TD] £ 455.00[/TD]
[TD] £ 6,892.33[/TD]
[TD] £ -[/TD]
[TD] £ 6,892.33[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,223,900
Messages
6,175,276
Members
452,629
Latest member
SahilPolekar

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