Link to home
Start Free TrialLog in
Avatar of Neil Randall
Neil RandallFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Toggle Interior.ColorIndex using mouse clicks

I have found the following code that changes the colour of a cell when clicked to Red

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count = 1 Then Target.Interior.ColorIndex = 3
End Sub

This is fine, but what happens if I click the wrong cell?

What code would do the following:

Click a single cell
Check the cell has [No Fill]
If [No Fill] then fill [Red]
If [Red] then reset to [No Fill]

I think I have the logic of what I want to do, but not the knowledge of the code required.
Which is where you experts come in.

Thanks for your time

Neil
ASKER CERTIFIED SOLUTION
Avatar of Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Ingeborg Hawighorst (Microsoft MVP / EE MVE)
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Neil Randall

ASKER

Excellent Teylyn

that is exactly what I want.

Thanks

Neil