+ Reply to Thread
Results 1 to 6 of 6

Is it possible to lock the fill color of a cell to a specific range of colors?

  1. #1
    Registered User
    Join Date
    09-04-2012
    Location
    Ruse
    MS-Off Ver
    Excel 2003
    Posts
    22

    Is it possible to lock the fill color of a cell to a specific range of colors?

    Hello all,

    Is there a possibility in excel to lock the fill color of a cell to only specific types of colors? For example in the attached sheet I have 7 exact possibilities to fill each cell shown in the legend in the upper left corner. What I want to restrict is the users to be able to use only these exact colors when they fill the color of each cell in the weekly schedule below. The reason for that is because I have a VBA formula which looks to the color of each cell and after that summarize the number of people who have worked on each shift. In order this formula not to miss any person in the total sum I need the exact same color to be used every time I mark "first shift" for example. If for example monday is marked with light yellow and tuesday with darker yellow the formula will not give me the correct sum at the end of the day, because the darker yellow will not be recognized. Can someone advice me if such restriction is possible at all?
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Is it possible to lock the fill color of a cell to a specific range of colors?

    I would have your colours that are acceptable in an array, and then when the worksheet is changed, check to see if the color code has changed then check this array, if its not in the array put it back to where it was.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    09-04-2012
    Location
    Ruse
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Is it possible to lock the fill color of a cell to a specific range of colors?

    Sounds great but could you please help me to build up an example? In fact if I knew how to do it I would be never asking here

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Is it possible to lock the fill color of a cell to a specific range of colors?

    Hi,

    Personally I think you are on dangerous ground using and trying to distinguish colours with VBA in this way. I've seen two many problems to recommend this as a method.

    You are making the same mistake that I see time and time again and mixing up the two elements of data capture and final reporting. The two require quite different treatments. A lot of people start by designing the form that they expect to see as the final report, and then wonder why it's so difficult to subsequently analyse and summarise or extract information from it, Yours exhibits all those features.


    You should always capture data in a simple two dimensional table and worry about reporting information from it afterwards. Without exception doing this you will always be able to easily obtain management information. Rarely is this the case if you start the other way round.
    You will also throw open the whole wonderful world of the powerful Pivot table functionality.

    In this case a Pivot Table seems the obvious answer so capture data in a table which contains the following columns

    Date
    Team
    Name
    Shift
    Value

    Fields like Team, Name & Shift could usefully contain Data validation drop down (pick) lists to speed data entry.
    Once you have the database then the Pivot Table can be created in a few moments and be much more flexible and efficient.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Registered User
    Join Date
    09-04-2012
    Location
    Ruse
    MS-Off Ver
    Excel 2003
    Posts
    22

    Re: Is it possible to lock the fill color of a cell to a specific range of colors?

    I'm quite familiar with the pivot tables and use them very often. Unfortunately this is the approved report by my manager and I'm not able to change it. In other words what I can do is to find the best way to get out the data from it.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Is it possible to lock the fill color of a cell to a specific range of colors?

    Hi,

    I'd still be inclined to use the database approach for capturing the data. Then if you don't want to use a Pivot Table, (which would be a shame - time to try and educate your manager methinks, explaining how much more efficient it is and how it will save the company time and hence money), then use either standard functions to populate your table perhaps using conditional formatting, or write a simple macro to generate your table from the database.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] change fill color of a range of cells based on color of a cell?
    By DarMelNel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2014, 04:48 PM
  2. Change bar chart fill colors to match the color of a random cell
    By gwbe in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-03-2014, 08:12 PM
  3. Change Cell Fill Color Based on Colors in 2 Columns
    By djkante in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-05-2010, 08:07 PM
  4. Replies: 3
    Last Post: 07-08-2010, 06:48 PM
  5. Lock fill colour to specific cell
    By mattsson_karl in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 10-27-2008, 11:09 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1