Change cell coulor with a single click

L

Legacy 237453

Guest
Hi

Can somebody tell me how i can change the coulor of a cell when somebody clicks the cell using VBA?
I need the cells to turn green.

If you need more info please let me know. :)

Many Thanks
Craig!
 
Ok Kreszch68's code works great.... the only thing is you have to navigate away from that cell... then go back and double click it to get it to change coulor... Ideally if possible

The first coulor change would be a double click to get green
Then another single click to get to orange
then another single click to get to red
then another single click back to white......
Then on a loop lol

I cant thank you guys enough, if its not possible or im asking to much then its no worries you have helped enough :)
Thanks
Craig
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try this

Rich (BB code):
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Const vGreen As Variant = 43
Const vOrange As Variant = 44
Const vRed As Variant = 3
Cancel = True
Select Case Target.Interior.ColorIndex
    Case xlColorIndexNone
        Target.Interior.ColorIndex = vGreen
    Case vGreen
        Target.Interior.ColorIndex = vOrange
    Case vOrange
        Target.Interior.ColorIndex = vRed
    Case vRed
        Target.Interior.ColorIndex = xlColorIndexNone
End Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,161
Messages
6,123,363
Members
449,097
Latest member
thnirmitha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top