This seems to work but I would have thought that hiding the Columns and
diplicate Rows would have been a betetr option because then there would be
no loss of data.
Option Explicit
Sub MergeItandCentre()
Dim LastRow As Long
Dim LineRow As Long
Dim cCell As Long
Dim Col As Long
Dim N As Integer
Dim CellValue1
Dim CellValue2
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Columns("A:A").EntireColumn.Hidden = True
Columns("E:G").EntireColumn.Hidden = True
For LineRow = LastRow To 2 Step -1
For Col = 2 To 13
If (Col >= 4 And Col < 8) Then GoTo skip
CellValue1 = Cells(LineRow, Col).Value
CellValue2 = Cells(LineRow + 1, Col).Value
If Col = 3 Then
CellValue1 = Left(CellValue1, 12)
CellValue2 = Left(CellValue2, 12)
End If
If CellValue1 = CellValue2 Then
N = N + 1
End If
skip:
Next Col
If N = 8 Then
For cCell = 1 To 13
With Range(Cells(LineRow, cCell), Cells(LineRow + 1, cCell))
.MergeCells = True
.VerticalAlignment = xlCenter
End With
Next cCell
End If
N = 0
Next LineRow
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
--
HTH
Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings
[email protected]
Replace @mailinator.com with @tiscali.co.uk