Dim Cel As Range
Private Sub Worksheet_Activate()
Set Cel = ActiveCell
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
On Error Resume Next
Range(Cells(1, Cel.Column), Cells(Cel.Row - 1, Cel.Column)).Borders.Value = 0
Range(Cells(Cel.Row, 1), Cells(Cel.Row, Cel.Column - 1)).Borders.Value = 0
Range(Cells(1, Target.Column), Cells(Target.Row - 1, Target.Column)).BorderAround ColorIndex:=3, Weight:=xlThick
Range(Cells(Target.Row, 1), Cells(Target.Row, Target.Column - 1)).BorderAround ColorIndex:=3, Weight:=xlThick
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set Cel = ActiveCell
End Sub