Highlight cells with multiple conditions

  • Hi everyone,
    Pls help me fix this code below. I want to highlight cells with conditions as follow list

    • If col(I)=P then color col Q,R,S,T into green
    • If col(I)=P and col(Y) start with “Rev*” or “REV*” then color col Q,R,S,T into yellow
    • If remove value in col(Y) then col Q,R,S,T into green back
    • If remove value in col(I) then col Q,R,S,T nofill

    Thanks for you help.

  • Attach your workbook.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Maybe

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Hi KjBox,


    2) If col(I)=P and col(Y) start with “Rev*” or “REV*” then color col Q,R,S,T into yellow. For this condition, if I input col(I) then col(Y) => it run very well, however, if I input col(Y) first and then col(I) => it's no fill instead of highlight yellow. Would you have any solution for this issue ?

  • Try

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Try

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • HI KjBox,


    I'm sorry if it made you headache, but it's still highlight green eventhough i didnt input anything and the problem above is same.:(

  • I over-complicated it, try this

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • it works for me.


    Detail all the steps you take when it does not work for you. Also which row are you testing with?

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Hi KjBox,


    I test on row 9. Firstly, I remove P and Rev in col I and Y and col QRST nofill. Secondly, I input P in col I then col QRST turn green => OK. Third, I input "rev" in col Y, col QRST nofill =>it's should be yellow. Fouth, I remove P in col I then col QRST nofill => OK. Finally, I remove "rev" in col Y then col QRST turn green => it's should be nofill. It's my step to test.

  • OK, I got the bit about column D wrong, try this

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • You're welcome, pleased we got there in the end!


    Have you missed that I also did a revised code for your other thread


    https://www.ozgrid.com/forum/f…ta-from-another-worksheet


    The new code will drastically reduce the run time of the previous code when run on your full dataset.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!