Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
Please consider this code:
'setgar' is a publicly declared Range variable equal to the value of target acquired in another worksheet's 'SelectionChange' event. With this code, when that cell is selected, I wish to change it's fill colour based on it's state when selected. If the cell interior is green, it clears the cell of any colour. If it's clear of colour, it sets it green. (ccgreen is a custom colour)
However, it's not working. When I step through the code, it fails to identify the colour of the cell interior, so no actions are taken.
Where is my error?
Rich (BB code):
Sub singlesegment()
Application.EnableEvents = False
Application.ScreenUpdating = False
With ws_form
With segtar
If .Interior.Color = ccgreen Then .Cells.Interior.Color = xlNone
If .Interior.Color = xlNone Then .Cells.Interior.Color = ccgreen
End With
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
'setgar' is a publicly declared Range variable equal to the value of target acquired in another worksheet's 'SelectionChange' event. With this code, when that cell is selected, I wish to change it's fill colour based on it's state when selected. If the cell interior is green, it clears the cell of any colour. If it's clear of colour, it sets it green. (ccgreen is a custom colour)
However, it's not working. When I step through the code, it fails to identify the colour of the cell interior, so no actions are taken.
Where is my error?