krtxmrtz
Jun 22nd, 2006, 04:53 PM
I use this code to highlight the sheet's active cell:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range)
Static OldRange As Range
On Error Resume Next
Target.Interior.ColorIndex = 6 ' yellow - change as needed
OldRange.Interior.ColorIndex = xlColorIndexNone
Set OldRange = Target
End Sub
that I found here. (http://www.cpearson.com/excel.htm)
All the cells in my sheet are white (default) except for a few in various other colours. Anyone knows how to modify the code so that the old colour is restablished after the cell is no longer actove?
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range)
Static OldRange As Range
On Error Resume Next
Target.Interior.ColorIndex = 6 ' yellow - change as needed
OldRange.Interior.ColorIndex = xlColorIndexNone
Set OldRange = Target
End Sub
that I found here. (http://www.cpearson.com/excel.htm)
All the cells in my sheet are white (default) except for a few in various other colours. Anyone knows how to modify the code so that the old colour is restablished after the cell is no longer actove?