+ Reply to Thread
Results 1 to 6 of 6

Best way to change color of font in code?

  1. #1
    Registered User
    Join Date
    07-07-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    82

    Best way to change color of font in code?

    I have a code that converts a number to a smaller number based on various criteria. What would be the best way to show a different color for the font when the code changes the number?

    Example: A3 = 8. A 4 = 7. I want to have A4 be 7

    Would a conditional format code be best? Or should I use a =IF code?

    Here is the current code I am using to determine the affected number:

    =IF(OR(D9=""),"",IF($AA9<10,MIN(D9,D$6+2),MIN(D9,LOOKUP($AA9,{0,10,20,30,40},{0,7,8,9,10}))))

    Thanks

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Best way to change color of font in code?

    Use conditional formatting...

    =A4=7 >> Pick format
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    07-07-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    82

    Re: Best way to change color of font in code?

    That won't work because there are several different numbers that may apply.

    What I have is:

    D8:L8 that have different numbers anywhere from 1 to 20. The code I am using is used in D24:L8 that changes the numbers if the criteria is met. The numbers in D24 row will always be less than what is in the D8 row if the criteria is met, but most of the time it will not change. I want to have the font red when it does change.

    If you are a golfer, you may understand that the code is used to meet the ESC requirement in scoring for handicap purposes. The actual number scored is in the D8 row, and the adjusted number is the D24 row. I want to identify when an adjustment has been made using a different color font.

    Hope this better describes what I am trying to do.

    Thanks

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Best way to change color of font in code?

    Do you have a small sample workbook you can post for a visual?

  5. #5
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Best way to change color of font in code?

    =A3<>A4 Perhaps
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  6. #6
    Registered User
    Join Date
    07-07-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    82

    Re: Best way to change color of font in code?

    Quote Originally Posted by martindwilson View Post
    =A3<>A4 Perhaps
    I think that will work. Let me give it a shot.

    Thanks

+ 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