Sub MergeRows()
Dim lColStart As Long, stCurrent As String, stNext As String, lCount As Long, stFormat As String, stNotes As String
Dim dtStart As Date, dtEnd As Date, lcount2 As Long
Dim rTempNotes As Range, lTempStart As Long
lColStart = Range("1:1").Find("Title").Column
Set rTempNotes = Cells(1, lColStart + 9)
Range(Range("A1").Cells(1, lColStart), Range("A1").Cells(1, lColStart).End(xlToRight)).Copy
Range("A1").Cells(1, lColStart + 10).PasteSpecial (xlPasteAll)
lCount = 2
Do While stCurrent = stNext
If Cells(lCount, lColStart) = "" Then End
lTempStart = Len(stNotes)
stCurrent = Cells(lCount, lColStart) & Cells(lCount, lColStart + 4) & Cells(lCount, lColStart + 5) & Cells(lCount, lColStart + 6) & Cells(lCount, lColStart + 2)
stNext = Cells(lCount + 1, lColStart) & Cells(lCount + 1, lColStart + 4) & Cells(lCount + 1, lColStart + 5) & Cells(lCount + 1, lColStart + 6) & Cells(lCount + 1, lColStart + 1) - 1
If stCurrent = stNext Then
dtStart = Cells(lCount, lColStart + 1)
stFormat = stFormat & " " & Cells(lCount, lColStart + 3)
stNotes = stNotes & " " & Cells(lCount, lColStart + 7)
rTempNotes = stNotes
rTempNotes.Characters(Start:=lTempStart, Length:=Len(stNotes)).Font.ColorIndex = Cells(lCount, lColStart + 7).Font.ColorIndex
lCount = lCount + 1
Else
stFormat = stFormat & " " & Cells(lCount, lColStart + 3)
stNotes = stNotes & " " & Cells(lCount, lColStart + 7)
rTempNotes = stNotes
rTempNotes.Characters(Start:=lTempStart + 1, Length:=Len(stNotes)).Font.ColorIndex = Cells(lCount, lColStart + 7).Font.ColorIndex
dtEnd = Cells(lCount, lColStart + 2)
Range("A" & Rows.Count).Offset(0, lColStart + 9).End(xlUp).Offset(1, 0) = Cells(lCount, lColStart)
Range("A" & Rows.Count).Offset(0, lColStart + 10).End(xlUp).Offset(1, 0) = dtStart
Range("A" & Rows.Count).Offset(0, lColStart + 11).End(xlUp).Offset(1, 0) = dtEnd
Range("A" & Rows.Count).Offset(0, lColStart + 12).End(xlUp).Offset(1, 0) = stFormat
Range("A" & Rows.Count).Offset(0, lColStart + 13).End(xlUp).Offset(1, 0) = Cells(lCount, lColStart + 4)
Range("A" & Rows.Count).Offset(0, lColStart + 14).End(xlUp).Offset(1, 0) = Cells(lCount, lColStart + 5)
Range("A" & Rows.Count).Offset(0, lColStart + 15).End(xlUp).Offset(1, 0) = Cells(lCount, lColStart + 4)
rTempNotes.Copy Destination:=Range("A" & Rows.Count).Offset(0, lColStart + 16).End(xlUp).Offset(1, 0)
stFormat = ""
stNotes = ""
stCurrent = ""
stNext = ""
lCount = lCount + 1
End If
Loop
End Sub
Regards
Bookmarks