combining multiple sheets with VBA

Kellens

New Member
Joined
Aug 21, 2014
Messages
41
Hello,

I'm having a problem with a Workbook containing 12 or so sheets with some 56 columns per sheet.
I would like to combine all sheets in to one master file and have the data for identical columns combined.
To make it easier i think it is a good idea to start with a sheet that contains all possible column headers and also the supplier ID's

The first sheet then looks as follows with all blanks except first row and first column.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Supplier ID
[/TD]
[TD]Feature 1
[/TD]
[TD]Feature 2
[/TD]
[TD]Feature 3
[/TD]
[TD]Feature 4
[/TD]
[/TR]
[TR]
[TD]001
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]002
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]003
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]004
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]005
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]006
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]007
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]008
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]009
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


My second sheet then looks a bit as follows:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Supplier ID
[/TD]
[TD]Feature 3
[/TD]
[TD]Feature 1
[/TD]
[TD]Feature 5
[/TD]
[TD]Feature 12
[/TD]
[/TR]
[TR]
[TD]001
[/TD]
[TD]152
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]002
[/TD]
[TD][/TD]
[TD]slow
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]003
[/TD]
[TD][/TD]
[TD][/TD]
[TD]846541
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]004
[/TD]
[TD][/TD]
[TD]fast
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]005
[/TD]
[TD]12
[/TD]
[TD][/TD]
[TD][/TD]
[TD]strong
[/TD]
[/TR]
[TR]
[TD]006
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]weak
[/TD]
[/TR]
[TR]
[TD]007
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]008
[/TD]
[TD][/TD]
[TD]intermediate
[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]009
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]010
[/TD]
[TD]09
[/TD]
[TD][/TD]
[TD]5674654
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

So the first column is the same for every sheet.
If i have a column in the second or third (and so on) sheet that is identical to the first sheet i want the data to be included (not added on the bottom but on the same line as the corresponding supplier ID that is present in all sheets).

I hope it is clear what i would like to accomplish. I've tried to do this with the consolidate function wut that won't work.
Can anyone please herlp me out with a VBA script to do this?

Thanks in advance
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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