View Single Post
 
Old 11-06-2017, 05:37 PM
Logit Logit is offline Windows 10 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 587
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
This code is pasted in the Sheet Level module :

Code:
Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  'If the target cell is clear
     If Target.Interior.ColorIndex = xlNone Then

        'Then change the background to the specified color
        Target.Interior.ColorIndex = 6                          '6 is yellow

        'But if the target cell is already the specified color
        ElseIf Target.Interior.ColorIndex = 6 Then

        'Then change the background to the specified color
        'Target.Interior.ColorIndex = 3                         '3 is red

        'But if the target cell is already the specified color
        'ElseIf Target.Interior.ColorIndex = 3 Then

        'Then clear the background color
        Target.Interior.ColorIndex = xlNone

    End If
End Sub
Attached Files
File Type: xlsm Color Click Cell.xlsm (12.9 KB, 13 views)
Reply With Quote