Copy and pasting only certain sections of columns with VBA

ThePangloss

New Member
Joined
Jun 19, 2015
Messages
40
So I've got three sheets of data that have different columns. There are about 10 columns that are similar in all of them, and I'd like to be able to copy and paste them so they stack together under each other. The issue is that there are different product classes after every hundred or so rows. These product classes are arranged in order in all the sheets, and there's an ID column at the front that ID's the product class. So for example the three sheets would be like so.


The info that's the same would be manufacturing date, plan date, and release date and name. System ID and Info are not required. For these, I've labeled them the same way in each sheet, so it'd be easier when using a macro to find these columns. Obviously in the sheets they'd be in different positions but this is just a general example.

Sheet1

[TABLE="width: 500"]
<tbody>[TR]
[TD]Class Id[/TD]
[TD]Name[/TD]
[TD]Manufacturing Date[/TD]
[TD]Plan date[/TD]
[TD]System ID[/TD]
[TD]Info[/TD]
[TD]Release Date[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech1[/TD]
[TD]2/19/2012[/TD]
[TD]3/1/2009[/TD]
[TD]34892[/TD]
[TD]EX[/TD]
[TD]2/31/2013[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech2[/TD]
[TD]4/13/2002[/TD]
[TD]2/9/2001[/TD]
[TD]34243[/TD]
[TD]SA[/TD]
[TD]4/19/2006[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech3[/TD]
[TD]2/19/2012[/TD]
[TD]5/2/2006[/TD]
[TD]6546[/TD]
[TD]AD[/TD]
[TD]4/2/2012[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Space[/TD]
[TD]space1[/TD]
[TD]4/4/1996[/TD]
[TD]2/2/1995[/TD]
[TD]3453[/TD]
[TD]FD[/TD]
[TD]9/30/1998[/TD]
[/TR]
[TR]
[TD]Space[/TD]
[TD]space2[/TD]
[TD]4/8/2003[/TD]
[TD]7/3/2002[/TD]
[TD]34536[/TD]
[TD]AD[/TD]
[TD]5/2/2004[/TD]
[/TR]
</tbody>[/TABLE]
_______________________________________________________________________________
Sheet2[TABLE="width: 500"]
<tbody>[TR]
[TD]Class Id[/TD]
[TD]Name[/TD]
[TD]Manufacturing[/TD]
[TD]Plan date[/TD]
[TD]System ID[/TD]
[TD]Info[/TD]
[TD]Release Date[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech3[/TD]
[TD]2/19/2012[/TD]
[TD]3/1/2009[/TD]
[TD]34892[/TD]
[TD]EX[/TD]
[TD]2/31/2013[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech4[/TD]
[TD]4/13/2002[/TD]
[TD]2/9/2001[/TD]
[TD]34243[/TD]
[TD]SA[/TD]
[TD]4/19/2006[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech5[/TD]
[TD]2/19/2012[/TD]
[TD]5/2/2006[/TD]
[TD]6546[/TD]
[TD]AD[/TD]
[TD]4/2/2012[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Space[/TD]
[TD]space3[/TD]
[TD]4/4/1996[/TD]
[TD]2/2/1995[/TD]
[TD]3453[/TD]
[TD]FD[/TD]
[TD]9/30/1998[/TD]
[/TR]
[TR]
[TD]Space[/TD]
[TD]space4[/TD]
[TD]4/8/2003[/TD]
[TD]7/3/2002[/TD]
[TD]34536[/TD]
[TD]AD[/TD]
[TD]5/2/2004
[/TD]
[/TR]
</tbody>[/TABLE]
____________________________________________________________________
Sheet3
[TABLE="width: 500"]
<tbody>[TR]
[TD]Class Id[/TD]
[TD]Name[/TD]
[TD]Manufacturing Date[/TD]
[TD]Plan date[/TD]
[TD]System ID[/TD]
[TD]Info[/TD]
[TD]Release Date[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech7[/TD]
[TD]2/19/2012[/TD]
[TD]3/1/2009[/TD]
[TD]34892[/TD]
[TD]EX[/TD]
[TD]2/31/2013[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech8[/TD]
[TD]4/13/2002[/TD]
[TD]2/9/2001[/TD]
[TD]34243[/TD]
[TD]SA[/TD]
[TD]4/19/2006[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech9[/TD]
[TD]2/19/2012[/TD]
[TD]5/2/2006[/TD]
[TD]6546[/TD]
[TD]AD[/TD]
[TD]4/2/2012[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Space[/TD]
[TD]space5[/TD]
[TD]4/4/1996[/TD]
[TD]2/2/1995[/TD]
[TD]3453[/TD]
[TD]FD[/TD]
[TD]9/30/1998[/TD]
[/TR]
[TR]
[TD]Space[/TD]
[TD]space6[/TD]
[TD]4/8/2003[/TD]
[TD]7/3/2002[/TD]
[TD]34536[/TD]
[TD]AD[/TD]
[TD]5/2/2004
[/TD]
[/TR]
</tbody>[/TABLE]



There's a space in betewen each class ID to make it easier to separate each class. The final sheet, ideally should look like

[TABLE="width: 500"]
<tbody>[TR]
[TD]Class Id[/TD]
[TD]Name[/TD]
[TD]Manufacturing Date[/TD]
[TD]Plan date[/TD]
[TD]Release Date[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech1[/TD]
[TD]2/19/2012[/TD]
[TD]3/1/2009[/TD]
[TD]2/31/2013[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech2[/TD]
[TD]4/13/2002[/TD]
[TD]2/9/2001[/TD]
[TD]4/19/2006[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech3[/TD]
[TD]2/19/2012[/TD]
[TD]5/2/2006[/TD]
[TD]4/2/2012[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech4[/TD]
[TD]2/19/2012[/TD]
[TD]3/1/2009[/TD]
[TD]2/31/2013[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech5[/TD]
[TD]4/13/2002[/TD]
[TD]2/9/2001[/TD]
[TD]4/19/2006[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech6[/TD]
[TD]2/19/2012[/TD]
[TD]5/2/2006[/TD]
[TD]4/2/2012[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech7[/TD]
[TD]2/19/2012[/TD]
[TD]3/1/2009[/TD]
[TD]2/31/2013[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech8[/TD]
[TD]4/13/2002[/TD]
[TD]2/9/2001[/TD]
[TD]4/19/2006[/TD]
[/TR]
[TR]
[TD]Tech[/TD]
[TD]tech9[/TD]
[TD]2/19/2012[/TD]
[TD]5/2/2006[/TD]
[TD]4/2/2012[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Space[/TD]
[TD]space1[/TD]
[TD]4/4/1996[/TD]
[TD]2/2/1995[/TD]
[TD]9/30/1998[/TD]
[/TR]
[TR]
[TD]Space[/TD]
[TD]space2[/TD]
[TD]4/8/2003[/TD]
[TD]7/3/2002[/TD]
[TD]5/2/2004
[/TD]
[/TR]
[TR]
[TD]Space[/TD]
[TD]space3[/TD]
[TD]4/4/1996[/TD]
[TD]2/2/1995[/TD]
[TD]9/30/1998[/TD]
[/TR]
[TR]
[TD]Space[/TD]
[TD]space4[/TD]
[TD]4/8/2003[/TD]
[TD]7/3/2002[/TD]
[TD]5/2/2004[/TD]
[/TR]
[TR]
[TD]Space[/TD]
[TD]space5[/TD]
[TD]4/4/1996[/TD]
[TD]2/2/1995[/TD]
[TD]9/30/1998[/TD]
[/TR]
[TR]
[TD]Space[/TD]
[TD]space6[/TD]
[TD]4/8/2003[/TD]
[TD]7/3/2002[/TD]
[TD]5/2/2004[/TD]
[/TR]
</tbody>[/TABLE]


Any ideas would be great! Thanks
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

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