You could try with this code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' HIGHLIGHT THE ENTIRE ROW YOU HAVE HIGHLIGHTED (ONLY USE ON SHEETS WITH COLOR/FORMATTING COMPLETE)
Const cnNUMCOLS As Long = 100
Const cnHIGHLIGHTCOLOR As Long = 36 'default lt. yellow
Static rOld As Range
Static nColorIndices(1 To cnNUMCOLS) As Long
Static nBoldIndices(1 To cnNUMCOLS) As Long
Dim i As Long
If Not rOld Is Nothing Then 'Restore color indices
With rOld.Cells
If .Row = ActiveCell.Row Then Exit Sub 'same row, don't restore
For i = 1 To cnNUMCOLS
With .Item(i)
.Interior.ColorIndex = nColorIndices(i)
.Font.Bold = nBoldIndices(i)
End With
Next i
End With
End If
Set rOld = Cells(ActiveCell.Row, 1).Resize(1, cnNUMCOLS)
With rOld
For i = 1 To cnNUMCOLS
nColorIndices(i) = .Item(i).Interior.ColorIndex
If .Item(i).Font.Bold Then
nBoldIndices(i) = True
Else
nBoldIndices(i) = False
End If
Next i
.Interior.ColorIndex = cnHIGHLIGHTCOLOR
.Font.Bold = True
End With
' Cells(ActiveCell.Row, "C").Interior.ColorIndex = nColorIndices(3)
End Sub
Regards,
Antonio
Bookmarks