View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
JB2010
 
Posts: n/a
Default Update Macro: Leave Colour As Before Once Cell is Not Active

Hi there


i got this Macro code, which makes the Active cell change colour, but the
problem is that once you move away from that cell it leaves that cell with no
colour. I need it to return the colour the cell was before it became active.

What would i do to this code:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static OldCell As Range
If Not OldCell Is Nothing Then
OldCell.Interior.ColorIndex = xlColorIndexNone
End If
Target.Interior.ColorIndex = 8
Set OldCell = Target
End Sub


Any help gratefully received


cheers

jb