Hi All,
Here is a way to highlight the current row.
This code goes in worksheet module. Right click Tab Name > View code and paste the code there on the VBE window.
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'// Developed by Kris @ ExcelFox.com
Dim x, nmRow As Name
'if A1 holds '0', the macro won't fire
If Me.Range("A1") = 0 Then Exit Sub 'adjust the flag cell
On Error Resume Next
Set nmRow = ThisWorkbook.Names("tRow")
On Error GoTo 0
Const HighlightColor As Long = 6750207 'Adjust the highlight color
If nmRow Is Nothing Then
Set nmRow = ThisWorkbook.Names.Add("tRow", Target.Row & "|" & Target.EntireRow.Interior.Color, 0)
Target.EntireRow.Interior.Color = HighlightColor
Else
x = Split(Evaluate("tRow"), "|")
Me.Rows(CLng(x(0))).Interior.Color = IIf(CLng(x(1)) = 16777215, -4142, CLng(x(1)))
nmRow.RefersTo = Target.Row & "|" & Target.EntireRow.Interior.Color
Target.EntireRow.Interior.Color = HighlightColor
End If
End Sub
Note: This code ensures that you won't lose your row color.
Enjoy !
Bookmarks