Macro for Merging Rows with Matching & Sequential Info

Michael151

Board Regular
Joined
Sep 20, 2010
Messages
247
Hello all,

This is a simplified version of an earlier problem I had. What I’d like to do is write a macro that will merge two or more rows together if the start and end dates are sequential (start date is +1 date greater than end date of the row above it.

If the Title matches the row below, and the End Date and Start Date are 1 day apart (sequential), then merge the two rows, keeping the start date in the first row and the end date in the row. The Formats column should merge together and the Notes should merge together so no data is lost.

Also, I need to keep the formatting of the Notes and Format columns. So if the text in the Notes column is blue in one row, it should remain blue when it is merged into the row above. Same thing for the Format column – keep formatting including font color and bold/not bold.

In the example below, you’ll notice that Title1 merges into one row. This is because the Start Date of 1/25/11 is sequential (+1 number higher) than the End Date of 1/24/11 in the row above. The font and color of the Format and Notes columns are kept.

You’ll also notice that Title2 and Title3 merges from three rows into one. This is because all three sets of start/end dates are sequential.

If there is a break in dates, the macro will move onto the next row and continue to look for sequential dates within that title, before moving on to the next title.


Before:
<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if !mso]>******** classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]-->
<table class="MsoNormalTable" style="width: 240pt; margin-left: 4.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="320"> <tbody><tr style="height: 12.75pt;"> <td style="width: 48pt; border: 1pt solid windowtext; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Title
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Start Date
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
End Date
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Format
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Notes
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title1
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/21/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/24/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format1
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes1
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title1
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/25/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/28/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format2
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes2
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
03/01/10
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
3/10/2010
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format3
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes3
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
3/11/2010
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
3/29/2010
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format4
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes4
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
3/31/2010
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
4/15/2010
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format5
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes5
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title3
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/15/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/20/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format6
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes6
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title3
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/21/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/31/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format7
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes7
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title3
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
2/1/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
3/15/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format8
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes8
</td> </tr> </tbody></table>
After:

<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if !mso]>******** classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> <table class="MsoNormalTable" style="width: 374pt; margin-left: 4.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="499"> <tbody><tr style="height: 12.75pt;"> <td style="width: 48pt; border: 1pt solid windowtext; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Title
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Start Date
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
End Date
</td> <td style="width: 122pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="163">
Format
</td> <td style="width: 1.5in; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="144">
Notes
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title1
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/21/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/28/2011
</td> <td style="width: 122pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="163" nowrap="nowrap"> Format1 Format2
</td> <td style="width: 1.5in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="144" nowrap="nowrap"> Notes1 Notes2
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
03/01/10
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
4/15/2010
</td> <td style="width: 122pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="163" nowrap="nowrap"> Format3 Format4 Format5
</td> <td style="width: 1.5in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="144" nowrap="nowrap"> Notes3 Notes4Notes5
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title3
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/15/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
3/15/2011
</td> <td style="width: 122pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="163" nowrap="nowrap"> Format6 Format7 Format8
</td> <td style="width: 1.5in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="144" nowrap="nowrap"> Notes6 Notes7 Notes8
</td> </tr> </tbody></table>
Any help or guidance would be an enormous help to me - thank you so much for taking the time to read this or offer any help - much appreciated!



 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Assuming that Columns A through E contains the data, and that Row 1 contains the headers, try...

Code:
[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]

[color=darkblue]Sub[/color] MergeData()

    [color=darkblue]Dim[/color] Rng [color=darkblue]As[/color] Range
    [color=darkblue]Dim[/color] LastRow [color=darkblue]As[/color] [color=darkblue]Long[/color]
    [color=darkblue]Dim[/color] i [color=darkblue]As[/color] [color=darkblue]Long[/color]
    
    Application.ScreenUpdating = [color=darkblue]False[/color]
    
    LastRow = Cells(Rows.Count, "A").End(xlUp).Row
    
    [color=darkblue]Set[/color] Rng = Range(Cells(1, 1), Cells(LastRow, "E"))
    
    [color=darkblue]With[/color] Rng
        .Sort key1:=Range("A1"), order1:=xlAscending, key2:=Range("B1"), order1:=xlAscending, _
            Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTop[color=darkblue]To[/color]Bottom
    [color=darkblue]End[/color] [color=darkblue]With[/color]
    
    [color=darkblue]For[/color] i = LastRow To 3 [color=darkblue]Step[/color] -1
        [color=darkblue]If[/color] Cells(i, "A").Value = Cells(i - 1, "A").Value [color=darkblue]Then[/color]
            Cells(i - 1, "C").Value = Cells(i, "C").Value
            Cells(i - 1, "D").Value = Cells(i - 1, "D").Value & ", " & Cells(i, "D").Value
            Cells(i - 1, "E").Value = Cells(i - 1, "E").Value & ", " & Cells(i, "E").Value
            Rows(i).Delete
        [color=darkblue]End[/color] [color=darkblue]If[/color]
    [color=darkblue]Next[/color] i
    
    Columns.AutoFit  [color=green]'Optional[/color]
    
    Application.ScreenUpdating = [color=darkblue]True[/color]
    
    MsgBox "Completed...", vbInformation
        
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[/font]
 
Upvote 0
Domenic, thanks for your reply! Your macro does not quite work - it merges non-sequential dates and removes formatting from the text.

For example, look what happens when I put in 3/9/10 as an end date to the first row of Title2:

<TABLE style="MARGIN: auto auto auto 4.65pt; WIDTH: 240pt; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class=MsoNormalTable border=0 cellSpacing=0 cellPadding=0 width=320><TBODY><TR style="HEIGHT: 27pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes"><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64>
Title<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64>
Start Date<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64>
End Date<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64>
Format<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64>
Notes<o:p></o:p>


</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 1"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Title1<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/21/2011<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/24/2011<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Format1<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Notes1<o:p></o:p>

</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 2"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Title1<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/25/2011<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/28/2011<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Format2<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Notes2<o:p></o:p>

</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 3"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Title2<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
3/1/2010<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
3/9/2010<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Format3<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Notes3<o:p></o:p>

</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 4"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Title2<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
3/11/2010<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
3/29/2010<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Format4<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Notes4<o:p></o:p>

</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 5"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Title2<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
3/31/2010<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
4/15/2010<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Format5<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Notes5<o:p></o:p>

</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 6"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Title3<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/15/2011<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/20/2011<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Format6<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Notes6<o:p></o:p>

</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 7"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Title3<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/21/2011<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/31/2011<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Format7<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Notes7<o:p></o:p>

</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 8; mso-yfti-lastrow: yes"><TD style="BORDER-BOTTOM: #3867a6 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Title3<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: #3867a6 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
2/1/2011<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: #3867a6 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
3/15/2011<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: #3867a6 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Format8<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: #3867a6 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Notes8<o:p></o:p>

</TD></TR></TBODY></TABLE>​

This date is not sequential with the following row's start date of 3/11/10. However, the macro still merges this row and ends up with this result:

<TABLE style="MARGIN: auto auto auto 4.65pt; WIDTH: 364pt; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class=MsoNormalTable border=0 cellSpacing=0 cellPadding=0 width=485><TBODY><TR style="HEIGHT: 27pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes"><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 29pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=39>
Title<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64>
Start Date<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64>
End Date<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 128pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=171>
Format<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 111pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=148>
Notes<o:p></o:p>


</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 1"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 29pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=39 noWrap>Title1<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/21/2011<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/28/2011<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 128pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=171 noWrap>Format1, Format2<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 111pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=148 noWrap>Notes1, Notes2<o:p></o:p>

</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 2"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 29pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=39 noWrap>Title2<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
3/1/2010<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
4/15/2010<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 128pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=171 noWrap>Format3, Format4, Format5<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 111pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=148 noWrap>Notes3, Notes4, Notes5<o:p></o:p>

</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 3; mso-yfti-lastrow: yes"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 29pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=39 noWrap>Title3<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/15/2011<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
3/15/2011<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 128pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=171 noWrap>Format6, Format7, Format8<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 111pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=148 noWrap>Notes6, Notes7, Notes8<o:p></o:p>

</TD></TR></TBODY></TABLE>​


Also notice the formatting color removed in the Notes column of Title1 and Title2. The correct result (with the sequential and non-sequential dates and formatting) should be:

<TABLE style="MARGIN: auto auto auto 4.65pt; WIDTH: 371pt; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class=MsoNormalTable border=0 cellSpacing=0 cellPadding=0 width=495><TBODY><TR style="HEIGHT: 27pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes"><TD style="BORDER-BOTTOM: windowtext 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: windowtext 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64>
Title<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64>
Start Date<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64>
End Date<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 122pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=163>
Format<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 105pt; PADDING-RIGHT: 5.4pt; BACKGROUND: silver; HEIGHT: 27pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=140>
Notes<o:p></o:p>


</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 1"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Title1<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/21/2011<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/28/2011<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 122pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=163 noWrap>Format1 Format2<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 105pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=140 noWrap>Notes1 Notes2<o:p></o:p>

</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 2"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Title2<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
3/1/2010<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
3/9/2010<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 122pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=163 noWrap>Format3<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 105pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=140 noWrap>Notes3<o:p></o:p>

</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 3"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Title2<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
3/11/2010<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
4/15/2010<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 122pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=163 noWrap>Format4 Format5<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 105pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=140 noWrap>Notes4 Notes5<o:p></o:p>

</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 4; mso-yfti-lastrow: yes"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>Title3<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
1/15/2011<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: #3867a6 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64 noWrap>
3/15/2011<o:p></o:p>


</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 122pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=163 noWrap>Format6 Format7 Format8<o:p></o:p>

</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 105pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=140 noWrap>Notes6 Notes7 Notes8<o:p></o:p>

</TD></TR></TBODY></TABLE>​


Thank you for your help - I appreciate the time spent on this.
 
Upvote 0
<TABLE style="WIDTH: 240pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=320><COLGROUP><COL style="WIDTH: 48pt" span=5 width=64><TBODY><TR style="HEIGHT: 15.75pt" height=21><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid" class=xl63 height=21 width=64>Title2</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid" class=xl64 width=64>3/11/10</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid" class=xl64 width=64>3/29/10</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid" class=xl65 width=64>Format4</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid" class=xl65 width=64>Notes4</TD></TR><TR style="HEIGHT: 15.75pt" height=21><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: black 1pt solid; BACKGROUND-COLOR: transparent; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid" class=xl63 height=21>Title2</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid" class=xl64>3/31/10</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid" class=xl64>4/15/10</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid" class=xl65>Format5</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: transparent; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid" class=xl66>Notes5</TD></TR></TBODY></TABLE>

For the above two rows, the dates are not sequential. You have an end date of 3/29/10 and a start date of 3/31/10. Yet you'd like to merge these two rows. Can you please clarify?
 
Upvote 0
My appologies, that should be:

<TABLE style="MARGIN: auto auto auto 4.65pt; WIDTH: 240pt; BORDER-COLLAPSE: collapse; mso-yfti-tbllook: 1184; mso-padding-alt: 0in 5.4pt 0in 5.4pt" class=MsoNormalTable border=0 cellSpacing=0 cellPadding=0 width=320><TBODY><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes"><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in" vAlign=bottom width=64>Title2<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: solid #F0F0F0 1.0pt" vAlign=bottom width=64>
3/11/2010<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: solid #F0F0F0 1.0pt" vAlign=bottom width=64>
3/30/2010<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: solid #F0F0F0 1.0pt" vAlign=bottom width=64>Format4<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: black 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #3867a6 1pt solid; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: solid #F0F0F0 1.0pt" vAlign=bottom width=64>Notes4<o:p></o:p>
</TD></TR><TR style="HEIGHT: 15.75pt; mso-yfti-irow: 1; mso-yfti-lastrow: yes"><TD style="BORDER-BOTTOM: #3867a6 1pt solid; BORDER-LEFT: #3867a6 1pt solid; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-top-alt: solid #F0F0F0 1.0pt" vAlign=bottom width=64>Title2<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: #3867a6 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: solid #F0F0F0 1.0pt; mso-border-top-alt: solid #F0F0F0 1.0pt" vAlign=bottom width=64>
3/31/2010<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: #3867a6 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: solid #F0F0F0 1.0pt; mso-border-top-alt: solid #F0F0F0 1.0pt" vAlign=bottom width=64>
4/15/2010<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: #3867a6 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: black 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: solid #F0F0F0 1.0pt; mso-border-top-alt: solid #F0F0F0 1.0pt" vAlign=bottom width=64>Format5<o:p></o:p>
</TD><TD style="BORDER-BOTTOM: #3867a6 1pt solid; BORDER-LEFT: #f0f0f0; PADDING-BOTTOM: 0in; PADDING-LEFT: 5.4pt; WIDTH: 48pt; PADDING-RIGHT: 5.4pt; BACKGROUND: #efefef; HEIGHT: 15.75pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #3867a6 1pt solid; PADDING-TOP: 0in; mso-border-left-alt: solid #F0F0F0 1.0pt; mso-border-top-alt: solid #F0F0F0 1.0pt" vAlign=bottom width=64>Notes5<o:p></o:p>
</TD></TR></TBODY></TABLE>
 
Upvote 0
Try...

Code:
[font=Verdana][color=darkblue]Option[/color] [color=darkblue]Explicit[/color]

[color=darkblue]Sub[/color] MergeData()

    [color=darkblue]Dim[/color] MyArray() [color=darkblue]As[/color] [color=darkblue]Variant[/color]
    [color=darkblue]Dim[/color] Rng [color=darkblue]As[/color] Range
    [color=darkblue]Dim[/color] LastRow [color=darkblue]As[/color] [color=darkblue]Long[/color]
    [color=darkblue]Dim[/color] Cnt [color=darkblue]As[/color] [color=darkblue]Long[/color]
    [color=darkblue]Dim[/color] r [color=darkblue]As[/color] [color=darkblue]Long[/color]
    [color=darkblue]Dim[/color] c [color=darkblue]As[/color] [color=darkblue]Long[/color]
    [color=darkblue]Dim[/color] i [color=darkblue]As[/color] [color=darkblue]Long[/color]
    [color=darkblue]Dim[/color] j [color=darkblue]As[/color] [color=darkblue]Long[/color]
    [color=darkblue]Dim[/color] k [color=darkblue]As[/color] [color=darkblue]Long[/color]
    
    Application.ScreenUpdating = [color=darkblue]False[/color]
    
    LastRow = Cells(Rows.Count, "A").End(xlUp).Row
    
    [color=darkblue]Set[/color] Rng = Range(Cells(1, "A"), Cells(LastRow, "E"))
    
    [color=darkblue]With[/color] Rng
        .Sort key1:=Range("A1"), order1:=xlAscending, key2:=Range("B1"), order1:=xlAscending, _
            Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTop[color=darkblue]To[/color]Bottom
    [color=darkblue]End[/color] [color=darkblue]With[/color]
    
    [color=darkblue]For[/color] r = LastRow [color=darkblue]To[/color] 3 [color=darkblue]Step[/color] -1
        [color=darkblue]If[/color] Cells(r, "A").Value = Cells(r - 1, "A").Value [color=darkblue]Then[/color]
            [color=darkblue]If[/color] Cells(r - 1, "C").Value + 1 = Cells(r, "B").Value [color=darkblue]Then[/color]
                Cells(r - 1, "C").Value = Cells(r, "C").Value
                [color=darkblue]For[/color] c = 4 [color=darkblue]To[/color] 5
                        [color=darkblue]For[/color] i = 1 [color=darkblue]To[/color] Len(Cells(r - 1, c).Value)
                            Cnt = Cnt + 1
                            [color=darkblue]ReDim[/color] [color=darkblue]Preserve[/color] MyArray(1 [color=darkblue]To[/color] 2, 1 [color=darkblue]To[/color] Cnt)
                            MyArray(1, Cnt) = Cells(r - 1, c).Characters(i, 1).Font.ColorIndex
                            MyArray(2, Cnt) = Cells(r - 1, c).Characters(i, 1).Font.Bold
                        [color=darkblue]Next[/color] i
                        Cnt = Cnt + 1
                        [color=darkblue]For[/color] j = 1 [color=darkblue]To[/color] Len(Cells(r, c).Value)
                            Cnt = Cnt + 1
                            [color=darkblue]ReDim[/color] [color=darkblue]Preserve[/color] MyArray(1 To 2, 1 To Cnt)
                            MyArray(1, Cnt) = Cells(r, c).Characters(j, 1).Font.ColorIndex
                            MyArray(2, Cnt) = Cells(r, c).Characters(j, 1).Font.Bold
                        [color=darkblue]Next[/color] j
                        Cells(r - 1, c).Value = Cells(r - 1, c).Value & " " & Cells(r, c).Value
                        [color=darkblue]For[/color] k = 1 To Len(Cells(r - 1, c).Value)
                            [color=darkblue]With[/color] Cells(r - 1, c).Characters(k, 1).Font
                                .ColorIndex = MyArray(1, k)
                                .Bold = MyArray(2, k)
                            [color=darkblue]End[/color] [color=darkblue]With[/color]
                        [color=darkblue]Next[/color] k
                        Cnt = 0
                        Erase MyArray
                [color=darkblue]Next[/color] c
                Rows(r).Delete
            [color=darkblue]End[/color] [color=darkblue]If[/color]
        [color=darkblue]End[/color] [color=darkblue]If[/color]
    [color=darkblue]Next[/color] r
    
    Columns.AutoFit
    
    Application.ScreenUpdating = [color=darkblue]True[/color]
    
    MsgBox "Completed...", vbInformation
        
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
[/font]
 
Upvote 0
Hi Domenic,

Was wondering if you might be able to help modify this equation to accommodate another scenario. What I’m trying to do is merge two or more rows if the dates range falls partially or entirely within another range of the same title.

For example, I have a start and end date in row 2. Then on row 3 (if the titles match in col A), if the start date is after the start date on row 2 but before the end date in row 2 and the end date on row 3 is after the start date on row 2, but before the end date on row 2, then merge the rows (merge Format and Notes columns) and use the start date and end date in row 2 as the start date and end date for the two merged rows. Basically, the dates range on row 3 falls within the range on row 2, so we can merge the rows.

Similar thing for if the start date on row 3 fell between the start and end date on row 2, but the end date on row 3 fell after the start date on row 2. In this case, we would use the start date on row 2, but use the end date on row 3 when merging the rows.

Something like:

If B – 1 > B And B – 1 < C And C – 1 < C Then merge rows (fonts and formatting kept the same as original code) and use B and C as start and end dates

If B – 1 > B And B – 1 < C And C – 1 > C Then merge rows (fonts and formatting kept the same as original code) and use B and C – 1 as start and end dates

If B – 1 < B And B – 1 < C And C – 1 < C Then merge rows (fonts and formatting kept the same as original code) and use B – 1 and C as start and end dates

Before:

<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if !mso]>******** classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> <table class="MsoNormalTable" style="width: 240pt; margin-left: 4.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="320"> <tbody><tr style="height: 12.75pt;"> <td style="width: 48pt; border: 1pt solid windowtext; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Title
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Start Date
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
End Date
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Format
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Notes
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title1
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/21/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/29/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format1
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes1
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title1
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/25/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/27/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format2
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes2
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
03/01/10
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
3/10/2010
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format3
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes3
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
3/5/2010
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
3/30/2010
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format4
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes4
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title3
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/15/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/31/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format6
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes6
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title3
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/13/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/20/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Format7
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Notes7
</td> </tr> </tbody></table>
After:

<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if !mso]>******** classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> <table class="MsoNormalTable" style="width: 299pt; margin-left: 4.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="399"> <tbody><tr style="height: 12.75pt;"> <td style="width: 48pt; border: 1pt solid windowtext; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Title
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Start Date
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
End Date
</td> <td style="width: 81pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="108">
Format
</td> <td style="width: 74pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="99">
Notes
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title1
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/21/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/29/2011
</td> <td style="width: 81pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="108" nowrap="nowrap"> Format1 Format2
</td> <td style="width: 74pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="99" nowrap="nowrap"> Notes1 Notes2
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
03/01/10
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
3/30/2010
</td> <td style="width: 81pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="108" nowrap="nowrap"> Format3 Format4
</td> <td style="width: 74pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="99" nowrap="nowrap"> Notes3 Notes4
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title3
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/13/2011
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/31/2011
</td> <td style="width: 81pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="108" nowrap="nowrap"> Format6 Format7
</td> <td style="width: 74pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="99" nowrap="nowrap"> Notes6 Notes7
</td> </tr> </tbody></table>
Your help is so greatly appreciated - thank you!

Original Code with sections to change highlighted red:
Code:
[FONT=Verdana][COLOR=darkblue]Option[/COLOR] [COLOR=darkblue]Explicit[/COLOR]

[COLOR=darkblue]Sub[/COLOR] MergeData()

    [COLOR=darkblue]Dim[/COLOR] MyArray() [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Variant[/COLOR]
    [COLOR=darkblue]Dim[/COLOR] Rng [COLOR=darkblue]As[/COLOR] Range
    [COLOR=darkblue]Dim[/COLOR] LastRow [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
    [COLOR=darkblue]Dim[/COLOR] Cnt [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
    [COLOR=darkblue]Dim[/COLOR] r [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
    [COLOR=darkblue]Dim[/COLOR] c [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
    [COLOR=darkblue]Dim[/COLOR] i [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
    [COLOR=darkblue]Dim[/COLOR] j [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
    [COLOR=darkblue]Dim[/COLOR] k [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]Long[/COLOR]
    
    Application.ScreenUpdating = [COLOR=darkblue]False[/COLOR]
    
    LastRow = Cells(Rows.Count, "A").End(xlUp).Row
    
    [COLOR=darkblue]Set[/COLOR] Rng = Range(Cells(1, "A"), Cells(LastRow, "E"))
    
    [COLOR=darkblue]With[/COLOR] Rng
        .Sort key1:=Range("A1"), order1:=xlAscending, key2:=Range("B1"), order1:=xlAscending, _
            Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTop[COLOR=darkblue]To[/COLOR]Bottom
    [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]With[/COLOR]
    
    [COLOR=darkblue]For[/COLOR] r = LastRow [COLOR=darkblue]To[/COLOR] 3 [COLOR=darkblue]Step[/COLOR] -1
        [COLOR=darkblue]If[/COLOR] Cells(r, "A").Value = Cells(r - 1, "A").Value [COLOR=darkblue]Then[/COLOR]
[COLOR=Red]If Cells(r - 1, "C").Value + 1 = Cells(r, "B").Value [/COLOR][COLOR=Red]Then
                Cells(r - 1, "C").Value = Cells(r, "C").Value[/COLOR]
                [COLOR=darkblue]For[/COLOR] c = 4 [COLOR=darkblue]To[/COLOR] 5
                        [COLOR=darkblue]For[/COLOR] i = 1 [COLOR=darkblue]To[/COLOR] Len(Cells(r - 1, c).Value)
                            Cnt = Cnt + 1
                            [COLOR=darkblue]ReDim[/COLOR] [COLOR=darkblue]Preserve[/COLOR] MyArray(1 [COLOR=darkblue]To[/COLOR] 2, 1 [COLOR=darkblue]To[/COLOR] Cnt)
                            MyArray(1, Cnt) = Cells(r - 1, c).Characters(i, 1).Font.ColorIndex
                            MyArray(2, Cnt) = Cells(r - 1, c).Characters(i, 1).Font.Bold
                        [COLOR=darkblue]Next[/COLOR] i
                        Cnt = Cnt + 1
                        [COLOR=darkblue]For[/COLOR] j = 1 [COLOR=darkblue]To[/COLOR] Len(Cells(r, c).Value)
                            Cnt = Cnt + 1
                            [COLOR=darkblue]ReDim[/COLOR] [COLOR=darkblue]Preserve[/COLOR] MyArray(1 To 2, 1 To Cnt)
                            MyArray(1, Cnt) = Cells(r, c).Characters(j, 1).Font.ColorIndex
                            MyArray(2, Cnt) = Cells(r, c).Characters(j, 1).Font.Bold
                        [COLOR=darkblue]Next[/COLOR] j
                        Cells(r - 1, c).Value = Cells(r - 1, c).Value & " " & Cells(r, c).Value
                        [COLOR=darkblue]For[/COLOR] k = 1 To Len(Cells(r - 1, c).Value)
                            [COLOR=darkblue]With[/COLOR] Cells(r - 1, c).Characters(k, 1).Font
                                .ColorIndex = MyArray(1, k)
                                .Bold = MyArray(2, k)
                            [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]With[/COLOR]
                        [COLOR=darkblue]Next[/COLOR] k
                        Cnt = 0
                        Erase MyArray
                [COLOR=darkblue]Next[/COLOR] c
                Rows(r).Delete
            [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
        [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
    [COLOR=darkblue]Next[/COLOR] r
    
    Columns.AutoFit
    
    Application.ScreenUpdating = [COLOR=darkblue]True[/COLOR]
    
    MsgBox "Completed...", vbInformation

[/FONT]


End Sub
 
Upvote 0
Here's what I have so far, but does not seem to be working...

Code:
        If Cells(r, "A").Value = Cells(r - 1, "A").Value Then
            If Cells(r - 1, "C").Value > Cells(r, "B").Value Then
            If Cells(r, "C").Value < Cells(r - 1, "C").Value Then
            If Cells(r, "B").Value > Cells(r - 1, "B").Value Then
           Cells(r, "C").Value = Cells(r, "C").Value And Cells(r, "B").Value = Cells(r, "B").Value
 
Upvote 0
Here's what I have so far for merging three overlapping rows:

<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if !mso]>******** classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> <table class="MsoNormalTable" style="width: 444pt; margin-left: 4.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="592"> <tbody><tr style="height: 12.75pt;"> <td style="width: 29pt; border: 1pt solid windowtext; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="39">
Title
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Start Date
</td> <td style="width: 53pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="71">
End Date
</td> <td style="width: 2.25in; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="216">
Format
</td> <td style="width: 152pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="203">
Notes
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 29pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="39" nowrap="nowrap"> Title1
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/1/2012
</td> <td style="width: 53pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="71" nowrap="nowrap">
12/31/2012
</td> <td style="width: 2.25in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="216" nowrap="nowrap"> Format1 Format1
</td> <td style="width: 152pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="203" nowrap="nowrap"> Notes1 Notes2
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 29pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="39" nowrap="nowrap"> Title1
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
03/01/12
</td> <td style="width: 53pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="71" nowrap="nowrap">
12/31/2013
</td> <td style="width: 2.25in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="216" nowrap="nowrap"> Format1 Format1
</td> <td style="width: 152pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="203" nowrap="nowrap"> Notes3 Notes4
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 29pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="39" nowrap="nowrap"> Title1
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
2/1/2012
</td> <td style="width: 53pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="71" nowrap="nowrap">
10/31/2012
</td> <td style="width: 2.25in; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="216" nowrap="nowrap"> Format1 Format1
</td> <td style="width: 152pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="203" nowrap="nowrap"> Notes7 Notes6
</td> </tr> </tbody></table>
Should become:

<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if !mso]>******** classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id=ieooui></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> <table class="MsoNormalTable" style="width: 602pt; margin-left: 4.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="803"> <tbody><tr style="height: 12.75pt;"> <td style="width: 29pt; border: 1pt solid windowtext; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="39">
Title
</td> <td style="width: 48pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64">
Start Date
</td> <td style="width: 53pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="71">
End Date
</td> <td style="width: 243pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="324">
Format
</td> <td style="width: 229pt; border-width: 1pt 1pt 1pt medium; border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; background: none repeat scroll 0% 0% silver; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="305">
Notes
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 29pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="39" nowrap="nowrap"> Title1
</td> <td style="width: 48pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">
1/1/2012
</td> <td style="width: 53pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="71" nowrap="nowrap">
12/31/2013
</td> <td style="width: 243pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="324" nowrap="nowrap"> Format1 Format1 Format1 Format1 Format1 Format1
</td> <td style="width: 229pt; border-width: medium 1pt 1pt medium; border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="305" nowrap="nowrap"> Notes1 Notes2 Notes3 Notes4 Notes7 Notes6
</td> </tr> </tbody></table>
Here's my code:

Code:
Option Explicit

Sub MergeData3()

    Dim MyArray() As Variant
    Dim Rng As Range
    Dim LastRow As Long
    Dim Cnt As Long
    Dim r As Long
    Dim c As Long
    Dim i As Long
    Dim j As Long
    Dim k As Long
    
    Application.ScreenUpdating = False
    
    LastRow = Cells(Rows.Count, "A").End(xlUp).Row
    
    Set Rng = Range(Cells(1, "A"), Cells(LastRow, "E"))
    
    With Rng
        .Sort key1:=Range("A1"), order1:=xlAscending, key2:=Range("B1"), order1:=xlAscending, _
            header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    End With
    
    For r = LastRow To 3 Step -1
        If Cells(r, "A").Value = Cells(r - 1, "A").Value And Cells(r, "D").Value = Cells(r - 1, "D").Value Then
            If Cells(r - 1, "C").Value > Cells(r, "B").Value Then
            If Cells(r - 1, "C").Value > Cells(r, "C").Value And Cells(r - 1, "C").Value > Cells(r - 2, "C").Value Then
            If Cells(r, "B").Value < Cells(r - 1, "B").Value Then
            If Cells(r - 2, "B").Value < Cells(r - 1, "B").Value And Cells(r - 2, "B").Value < Cells(r, "B").Value Then
        Cells(r, "B").Value = Cells(r - 2, "B").Value And Cells(r, "C").Value = Cells(r - 1, "C").Value

                For c = 4 To 5
                        For i = 1 To Len(Cells(r - 1, c).Value)
                            Cnt = Cnt + 1
                            ReDim Preserve MyArray(1 To 2, 1 To Cnt)
                            MyArray(1, Cnt) = Cells(r - 1, c).Characters(i, 1).Font.ColorIndex
                            MyArray(2, Cnt) = Cells(r - 1, c).Characters(i, 1).Font.Bold
                        Next i
                        Cnt = Cnt + 1
                        For j = 1 To Len(Cells(r, c).Value)
                            Cnt = Cnt + 1
                            ReDim Preserve MyArray(1 To 2, 1 To Cnt)
                            MyArray(1, Cnt) = Cells(r, c).Characters(j, 1).Font.ColorIndex
                            MyArray(2, Cnt) = Cells(r, c).Characters(j, 1).Font.Bold
                        Next j
                        Cells(r - 1, c).Value = Cells(r - 1, c).Value & " " & Cells(r, c).Value
                        For k = 1 To Len(Cells(r - 1, c).Value)
                            With Cells(r - 1, c).Characters(k, 1).Font
                                .ColorIndex = MyArray(1, k)
                                .Bold = MyArray(2, k)
                            End With
                        Next k
                        Cnt = 0
                        Erase MyArray
                Next c
                Rows(r).Delete
            End If
        End If
    End If
End If
End If

Next r
    
    Columns.AutoFit
    
    Application.ScreenUpdating = True
    
    MsgBox "Completed...", vbInformation
        
End Sub

Not quite working though...I'll keep at it...any help would be most appreciated!
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,729
Members
452,939
Latest member
WCrawford

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