Change Color In Cell On Click 2

A

Ange Kappas

Thanks Bob that works great, just one more detail since I didn't notice it
at first, What code would you put in to return the cell color back to white
on click again.
I would use that if I clicked a wrong cell.

Thanks
 
B

Bob Phillips

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Const WS_RANGE As String = "A1:I10"

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
If Target.Interior.ColorIndex = 6 Then
Target.Interior.ColorIndex = xlColorIndexNone
Else
Target.Interior.ColorIndex = 6
End If
End If
End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Top