Macro to merge rows in one column based on value in another column that has been sorted

sewed

New Member
Joined
Jul 15, 2014
Messages
17
I'm trying to enhance another macro i have that will go through several steps to resort rows. I now want vba code to add a column that merges all the rows associated with values that have been sorted in another column.

Below is an example of the current data structure looks like (not real data) and what i would like it to look like including formatting (see hyperlink).

Thanks in advance.


[TABLE="width: 543"]
<tbody>[TR]
[TD]Current[/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][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: center"]#[/TD]
[TD="align: center"]CODEII[/TD]
[TD="align: center"]SEQ[/TD]
[TD="align: center"]LINE Number[/TD]
[TD="align: center"]Directions[/TD]
[TD="align: center"]Start[/TD]
[TD="align: center"]Finish[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]Red[/TD]
[TD="align: center"]116330[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]AB[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]9/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]Red[/TD]
[TD="align: center"]116330[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]ABC[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]9/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]Blue[/TD]
[TD="align: center"]116330[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]AB[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]9/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]Orange[/TD]
[TD="align: center"]116330[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]ABCDE[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]9/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]Yellow[/TD]
[TD="align: center"]114103[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]ABC[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]9/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]6[/TD]
[TD="align: center"]Yellow[/TD]
[TD="align: center"]114103[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]AB[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]9/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]7[/TD]
[TD="align: center"]Red[/TD]
[TD="align: center"]114103[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]ABCDE[/TD]
[TD="align: center"]1/1/2014[/TD]
[TD="align: center"]3/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]8[/TD]
[TD="align: center"]Purple[/TD]
[TD="align: center"]114103[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]ABCDE[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]9/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]9[/TD]
[TD="align: center"]Blue[/TD]
[TD="align: center"]114103[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]ABC[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]9/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]10[/TD]
[TD="align: center"]Blue[/TD]
[TD="align: center"]112868[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]3ABZBC[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]9/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]11[/TD]
[TD="align: center"]Yellow[/TD]
[TD="align: center"]112868[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]3ABZBC[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]9/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]12[/TD]
[TD="align: center"]Orange[/TD]
[TD="align: center"]112868[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]ABC[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]9/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]13[/TD]
[TD="align: center"]Red[/TD]
[TD="align: center"]112868[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]ABC[/TD]
[TD="align: center"]1/1/2014[/TD]
[TD="align: center"]3/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]14[/TD]
[TD="align: center"]Green[/TD]
[TD="align: center"]112868[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]ABC[/TD]
[TD="align: center"]1/1/2014[/TD]
[TD="align: center"]3/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]15[/TD]
[TD="align: center"]Green[/TD]
[TD="align: center"]115981[/TD]
[TD="align: center"]1[/TD]
[TD="align: center"]AB[/TD]
[TD="align: center"]1/1/2014[/TD]
[TD="align: center"]3/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]16[/TD]
[TD="align: center"]Green[/TD]
[TD="align: center"]115981[/TD]
[TD="align: center"]2[/TD]
[TD="align: center"]AB[/TD]
[TD="align: center"]1/1/2014[/TD]
[TD="align: center"]3/1/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]17[/TD]
[TD="align: center"]Blue[/TD]
[TD="align: center"]115981[/TD]
[TD="align: center"]3[/TD]
[TD="align: center"]ABC[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]3/2/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]18[/TD]
[TD="align: center"]Yellow[/TD]
[TD="align: center"]115981[/TD]
[TD="align: center"]4[/TD]
[TD="align: center"]AB[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]3/2/2014[/TD]
[/TR]
[TR]
[TD="align: center"][/TD]
[TD="align: center"]19[/TD]
[TD="align: center"]Orange[/TD]
[TD="align: center"]115981[/TD]
[TD="align: center"]5[/TD]
[TD="align: center"]ABCDE[/TD]
[TD="align: center"]8/1/2013[/TD]
[TD="align: center"]3/2/2014[/TD]
[/TR]
</tbody>[/TABLE]


[TABLE="width: 543"]
<tbody>[TR]
[TD]Here is what i would like it to look like: https://www.dropbox.com/s/xc0kkj4meptbci8/vba.png?dl=0[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,222,398
Messages
6,165,767
Members
451,986
Latest member
samwize

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