Code: Select all
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim LastRow As Long: LastRow = Me.Range("A" & Rows.Count).End(xlUp).Row
Dim selRow As Long: selRow = Target.Row
If selRow > LastRow Then Exit Sub
If selRow = 1 Then Exit Sub
Dim LastCol As Long: LastCol = Me.Cells(1, Columns.Count).End(xlToLeft).Column
Cells.Interior.ColorIndex = xlNone
Range(Cells(selRow, 1), Cells(selRow, LastCol)).Interior.ColorIndex = 37
End Sub