I have the below code which is working well. Currently I'm able to double click through three different colours to highlight cells. I'd like a fourth double click to be blank/clear. Does anyone know how to add this?
Also, I'd rather use RGB colours but am not sure how to change this code to suit that.
I'm getting close to what I'm wanting but just chasing a little extra help to nail it!
Also, I'd rather use RGB colours but am not sure how to change this code to suit that.
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim rng As Range
Cancel = True
Set rng = ActiveSheet.Range("A1:f1")
If Intersect(Target, rng) Is Nothing Then Exit Sub
Select Case Target.Interior.ColorIndex
Case xlNone, 4: Target.Interior.ColorIndex = 3
Case 3: Target.Interior.ColorIndex = 45
Case 45: Target.Interior.ColorIndex = 4
Case Else: Target.Interior.ColorIndex = xlNone
End Select
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Target.Interior.ColorIndex = xlNone
End Sub
I'm getting close to what I'm wanting but just chasing a little extra help to nail it!