This would have been much easier had we had the workbook in the first place.

Sub Summary()
Dim ws As Worksheet:    Set ws = Sheets("Statement of Profit & Loss")
Dim LR As Long, LC As Long
Dim rCell As Range

LR = ws.Range("E" & Rows.Count).End(xlUp).Row
LC = ws.UsedRange.Columns.Count

Application.ScreenUpdating = False

For Each rCell In ws.Range("E5:E" & LR)
    If Not InStr(1, rCell.Value, "[Tx]") = 0 Then
        With rCell.Offset(0, -4).Resize(1, 4)
            .borders(xlEdgeTop).LineStyle = xlContinuous
            .borders(xlEdgeTop).Weight = xlThin
            .borders(xlEdgeBottom).LineStyle = xlContinuous
            .borders(xlEdgeBottom).Weight = xlMedium
        End With
        With rCell.Offset(0, 1).Resize(1, LC - rCell.Column)
            .borders(xlEdgeTop).LineStyle = xlContinuous
            .borders(xlEdgeTop).Weight = xlThin
            .borders(xlEdgeBottom).LineStyle = xlContinuous
            .borders(xlEdgeBottom).Weight = xlMedium
        End With
    ElseIf Not InStr(1, rCell.Value, "[H]") = 0 Then
        rCell.Offset(, -1).ClearContents
        rCell.Offset(, -4).ClearContents
        rCell.Offset(, 1).ClearContents
        rCell.Offset(, 4).ClearContents
    ElseIf IsEmpty(rCell) Then
        rCell.Offset(0, -4).Resize(1, 4).ClearContents
        rCell.Offset(0, 1).Resize(1, LC - rCell.Column).ClearContents
    End If
Next rCell

Application.ScreenUpdating = True

End Sub