Friday 4 April 2014

[best answer] How to automatically highlight the entire row when a cell is selected

excel automatically highlight a row when a cell is selected - "cross hairs"

If you are working on a large spreadsheet and moving between sheets, sometimes its difficult to see where the selected cell is.
This excel hack automatically draws a highlight "cross hairs" for the entire row and the column.


Here's how I achieved it...


Unlike other methods this doesn't interfere with cell contents.
What I do is draw 2 rectangles on the sheet and make them transparent. These will act as my cross hairs.
Then in the active sheet I add the following code in VBA...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

With ActiveSheet.Shapes("Rectangle 1")
.Left = 0
.Top = Target.Top
.Height = Target.Height
.Width = 19638
End With

With ActiveSheet.Shapes("Rectangle 2")
.Left = Target.Left
.Top = 0
.Height = 19638
.Width = Target.Width
End With

End Sub

No comments:

Post a Comment