View Single Post
  #5   Report Post  
D.Parker
 
Posts: n/a
Default

Thank you very much. If I reselect the cell at some other time will the past
color be retained, such that when a user clicks it will start from the last
know color in the case condition?

D.Parker

"Bob Phillips" wrote:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static iCellColour As Long
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:H10")) Is Nothing Then
With Target
Select Case .Interior.ColorIndex
Case 3: .Interior.ColorIndex = 5
Case 5: .Interior.ColorIndex = 6
Case 6: .Interior.ColorIndex = 10
Case Else: .Interior.ColorIndex = 3
End Select
End With
Me.Range("A1").Select
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"D.Parker" wrote in message
...
Hello:

Is there a way to change the ColorIndex of a given cell each time you
perform a left click with the mouse, within that same cell? I was going

to
setup a loop(s) to cycle through the 4 colors red, blue, yellow, and green
and start the sequence over if the user continues to click. Thank you.