Sub test()
Application.DisplayAlerts = False
For c = 1 To 5
For r = 21 To 3 Step -1
If Cells(r, c).Borders(xlEdgeTop).LineStyle = xlNone Then
Cells(r - 1, c) = Cells(r - 1, c) & Cells(r, c)
Range(Cells(r - 1, c), Cells(r, c)).Merge
End If
Next
Next
For r = 21 To 3 Step -1
If Cells(r, 6).Borders(xlEdgeTop).LineStyle = xlNone Then Rows(r).Delete
Next
Application.DisplayAlerts = True
End Sub
Sub test()
Application.DisplayAlerts = False
For c = 1 To 5
For r = 21 To 3 Step -1
If Cells(r, c).Borders(xlEdgeTop).LineStyle = xlNone Then
Cells(r - 1, c) = Cells(r - 1, c) & Cells(r, c)
Range(Cells(r - 1, c), Cells(r, c)).Merge
End If
Next
Next
For r = 21 To 3 Step -1
If Cells(r, 6).Borders(xlEdgeTop).LineStyle = xlNone Then Rows(r).Delete
Next
Application.DisplayAlerts = True
End Sub