+ Reply to Thread
Results 1 to 8 of 8

Fill cell colour based on value

  1. #1
    Forum Contributor
    Join Date
    12-31-2008
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    149

    Fill cell colour based on value

    I have a selected range of cells. I need code to go through each cell in the selection, and if the cell's value is "1" then fill the cell green, and if the cell is blank, then fill the cell red.

    Conditional formatting isnt an option in this case.

    If anyone has any ideas, I'd be most grateful. Thanks in advance.
    Last edited by bd528; 09-16-2010 at 08:47 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Fill cell colour based on value

    Why is Conditional Formatting not an option?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    12-31-2008
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: Fill cell colour based on value

    Quote Originally Posted by royUK View Post
    Why is Conditional Formatting not an option?
    Excellent question, and now that i think about it, conditional formatting is now an option!

    I've got the "1" cells green. How do I get the blank cells red? I cant see an option to conditionally format if a cell is empty.

    Thanks!

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Fill cell colour based on value

    Cell Value = ""

  5. #5
    Forum Contributor
    Join Date
    12-31-2008
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: Fill cell colour based on value

    Thanks for that.

    I've now remembered why I initially ruled out conditional formatting.

    Now that the cells are green and red, I want to remove the "1"s and leave their cells green, but if the "1"s go, so will the formatting.

    How can I get round this?

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Fill cell colour based on value

    Can you format the font of the cell, along with the background to be the same colour so you don't actually see the 1, although it is really there?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Fill cell colour based on value

    Alternatively have a hidden column that controls the Conditional Formatting

  8. #8
    Forum Contributor
    Join Date
    12-31-2008
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    149

    Re: Fill cell colour based on value

    2 great ideas. Thanks a lot!

    Solved!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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