K
KevHardy
Hi,
I’m using the code below to highlight the row of the active cell, but if you
click in the highlighted row again it loses its highlight.
What I need is some form of code I think to say “If the new active cell is
in the same row as the old cell, keep the highlight†– I’m just not good
enough at VBA to write it!
'Highlights the active cell row
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Excel.Range)
Static OldRng As Range
On Error Resume Next
Target.EntireRow.Interior.ColorIndex = 6
OldRng.EntireRow.Interior.ColorIndex = xlColorIndexNone
Set OldRng = Target
End Sub
Any ideas?
I’m using the code below to highlight the row of the active cell, but if you
click in the highlighted row again it loses its highlight.
What I need is some form of code I think to say “If the new active cell is
in the same row as the old cell, keep the highlight†– I’m just not good
enough at VBA to write it!
'Highlights the active cell row
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Excel.Range)
Static OldRng As Range
On Error Resume Next
Target.EntireRow.Interior.ColorIndex = 6
OldRng.EntireRow.Interior.ColorIndex = xlColorIndexNone
Set OldRng = Target
End Sub
Any ideas?