+ Reply to Thread
Results 1 to 3 of 3

Change a cell's font color based on conditions

  1. #1
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    231

    Change a cell's font color based on conditions

    Hi -

    Having trouble triggering a change in font color of a particular cell. See the attached worksheet and note the call procedure in the Sheet1 code window.

    Whenever the values in cells B4 or B6 change, the value in cell B8 changes as well. What I need is to call a macro that will look at the value in B8,...whenever it changes..., and change the font color to either red or blue based on these conditions:

    If cell B6 is < B4, turn B8 font to Red

    If cell B6 is > B4, turn the cell font to Blue

    First, I can' t figure out how to properly trigger my code to run. And secondly, the if statement in my code doesn't work either????? Here's my code so far:

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,775

    Re: Change a cell's font color based on conditions

    1. Your syntax for range reference is incorrect. You are missing Range in front of ("B6") etc in your IF statement.

    2. You'd trigger it using Worksheet_Change event, on cell B6. Since that's the value that is updated manually (i.e. doesn't have formula).

    But for this you don't need VBA. You can use either CF or custom number format.

    Using custom number format.
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    13,116

    Re: Change a cell's font color based on conditions

    How about
    Please Login or Register  to view this content.

+ 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. How to change color on font based on value in a cell
    By Fawa in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-21-2019, 03:11 PM
  2. Change cell format (cell color+font color) based on color of another cell
    By Dedaluss in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-30-2017, 03:27 AM
  3. Change Font Color Based On Adjacent Cell Color
    By Zorro9758 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-11-2013, 02:47 PM
  4. Change font color based on font color of another cell
    By Ibyers in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2012, 09:36 AM
  5. Change Font Color Based on Another Cell
    By k777 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-22-2010, 08:41 PM
  6. change font color based on cell value
    By herukuncahyono in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-03-2010, 03:34 AM
  7. Font to change color automatically based on value in cell.
    By mtwelsh72 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-23-2005, 03:06 PM

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