Original code @ http://msdn.microsoft.com/en-us/library/office/ff820716%28v=office.14%29.aspx
I had to add code to handle the error that occurred when you clicked on headers or corner button.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
If Target.Cells.Count > 1 _
Then
Exit Sub
End If
If Err.Number > 0 _
Then
Exit Sub
End If
Application.ScreenUpdating = False
' Clear the color of all the cells
Cells.Interior.ColorIndex = 0
With Target
' Highlight the entire row and column that contain the active cell
.EntireRow.Interior.ColorIndex = 8
.EntireColumn.Interior.ColorIndex = 8
End With
ActiveCell.Interior.ColorIndex = 6
Application.ScreenUpdating = True
End Sub