Sub test()
Dim xR As Range, xH As Range
For Each xR In [H2:H19]
If xH Is Nothing Then xR = Split(Replace(xR, "-", "+", , 2), "+")(2): Set xH = xR
If xR(2) <> "" Then xR(2) = Split(Replace(xR(2), "-", "+", , 2), "+")(2)
If xR(2) <> xR Then
With Range(xR, xH)
.Borders.Weight = 3
If .Count > 1 Then .Borders(12).Weight = 2
End With
Set xH = xR(2)
End If
Next
End Sub
Sub test()
Dim R, xR As Range, xH As Range, xE As Range, i&, V&
R = [D65536].End(xlUp).Row
For i = 2 To R
Set xR = Cells(i, "D")
If xH Is Nothing Then Set xH = Cells(i, "AD")
V = xR.MergeArea.Rows.Count
Set xE = xR(V)
If xR <> xE(2) Then
With Range(Cells(xE.Row, 1), xH)
.Borders.Weight = 4
If .Columns.Count > 1 Then .Borders(11).Weight = 2
If .Rows.Count > 1 Then .Borders(12).Weight = 2
End With
Set xH = Cells(i + V, "AD")
End If
i = i + V - 1
Next i
End Sub
Sub test1()
Dim R, xR As Range, xH As Range
R = [D65536].End(xlUp).Row
For Each xR In Range([D2], [D65536].End(xlUp))
If xH Is Nothing Then Set xH = Cells(xR.Row, "AD")
If xR(2) <> xR Then
With Range(xR(1, -2), xH)
.Borders.Weight = 4
If .Columns.Count > 1 Then .Borders(11).Weight = 2
If .Rows.Count > 1 Then .Borders(12).Weight = 2
End With
Set xH = Cells(xR.Row + 1, "AD")
End If
Next
End Sub