AVI,
Прописать теже условия на VBA
[vba]Код
Sub NewMacros()
Dim r As Range
Dim WSF As WorksheetFunction: Set WSF = Application.WorksheetFunction
With Sheet1.UsedRange
For Each r In .Rows
If WSF.CountA(r) > 0 Then
r.Borders(xlEdgeLeft).LineStyle = xlContinuous
r.Borders(xlEdgeRight).LineStyle = xlContinuous
End If
If r.Cells(1) <> r.Cells(1).Offset(-1) And Not IsEmpty(r.Cells(1)) Then
r.Borders(xlEdgeTop).LineStyle = xlContinuous
End If
If WSF.CountA(r) > 0 And WSF.CountA(r.Offset(1)) = 0 Then
r.Borders(xlEdgeBottom).LineStyle = xlContinuous
End If
Next
End With
End Sub
[/vba]