Maybe this:
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
For Each rCell In ws.Range("E1:E" & LR)
If Not InStr(1, rCell.Value, "[Tx]") = 0 Then
With rCell.Resize(1, LC - rCell.Column).Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
End With
With rCell.Resize(1, LC - rCell.Column).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
End With
ElseIf Not InStr(1, rCell.Value, "[H]") = 0 Then
rCell.Offset(, -1).Clear
rCell.Offset(, -4).Clear
rCell.Offset(, 1).Clear
rCell.Offset(, 4).Clear
ElseIf IsEmpty(rCell) Then
rCell.Resize(1, LC - rCell.Column).Clear
End If
Next rCell
End Sub
Bookmarks