Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-06-2017, 05:37 PM
Logit Logit is offline Control Buttons, Macros, Fill Colors Windows 10 Control Buttons, Macros, Fill Colors 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
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Font and Fill Colors invisible in Excel 2007 tiger hunt Excel 0 02-28-2017 02:19 AM
Control Buttons, Macros, Fill Colors Contract Template - Employment fill-in and macros tina_mariee Word 1 02-11-2017 04:56 PM
Control Buttons, Macros, Fill Colors Visual basic and Macros buttons are gray atom3 PowerPoint 3 03-04-2016 11:46 AM
Need to put two highlight buttons on toolbar in different colors davidmrt Word 6 12-11-2011 05:54 AM
Create a toolbar of fill colors itgoeson PowerPoint 0 08-24-2010 01:26 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:34 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft