Automatically Format Cell Based On Value

  • I need help writing VBA code (and guidance on where I should put it) that will enable me to change the format of text within a cell when the value of that cell changes. This code will need to look at each cell within a range and make the appropriate chance to EACH cell.


    Note that this value will not be changed by the user. It is a formula based cell and is therefore contingent on the values in other cells to affect it.


    I can't use conditional formatting because i have more than 3 criteria.


    Here is a basic description of my need:


    If any cell within a specified range has the value "A", it should be Bold, Red (255,0,0), and size 13 font.
    If any cell within the same range has a value of "B", it should be red (i don't know the RGB code), and size 10 font.
    If any cell within the same range has a value of "C", the text should be green and size 10 font.
    If any cell within the same range has a value of "C", the text should be Bold,green, and size 13 font.


    Can anyone help?


    Thanks!

  • Re: Automatically Format Cell Based On Value


    Quote

    lower your assumed experience.


    Agree. Experts should be able to do this easily. Still learning the ropes myself.


  • Re: Automatically Format Cell Based On Value


    Thanks, AAE. Also, sorry about being labeled as Expert. I don't remember selecting that when I'd signed up, b/c am certainly not an Expert. Still learning a lot about VBA.


    Actually, one more question.


    Is there a variation on the SelectionChange that I can use, so it will only activate when the values in those specific cells actually change? Otherwise everytime I even just click on another cell in my workbook, the screen flashes while the macros rerun. And I am using this same macro on several worksheets within the workbook, so it ends up flashing for quite a while.


    Any ideas?

  • Re: Automatically Format Cell Based On Value


    Quote

    Is there a variation on the SelectionChange that I can use, so it will only activate when the values in those specific cells actually change?


    I've only tested on one worksheet, but the code, as originally supplied, will update the cells only when a cell in the defined range is made active and changed. Did you make changes to the code?

    Quote


    the screen flashes while the macros rerun


    To stop screen flicker put these two lines in the code: