Conditional Format Multiple Userform Textboxes dependent on value

  • Hi,


    I have 58 text boxes all of which can have a value from -32 to 40 and im trying to set a colour of the textbox dependant on its number,


    between -32 and -3 is one colour
    between -2 on 0 is another colour
    and
    between 1 and 40 is another colour.


    Ive tried using various bit of code but cant quite get anything to work.


    Has anyone got any insights to share?


    Thanks in advance


    The below code is the closest I have got,


    I have also posted this thread here http://www.excelforum.com/show…617&p=4427326#post4427326


  • Re: Conditional Format Multiple Userform Textboxes dependent on value


    Quote


    cant quite get anything to work....
    The below code is the closest I have got


    What specifically is not working with this code?


    Ger

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

  • Re: Conditional Format Multiple Userform Textboxes dependent on value


    This seems to work:


    Not sure why you have for C=1 to 1 ... i commented it out.

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

  • Re: Conditional Format Multiple Userform Textboxes dependent on value


    And if it doesnt work, please share your workbook so that i can debug it.

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

  • Re: Conditional Format Multiple Userform Textboxes dependent on value


    Excellent works great thank you very much.


    Quick question, I have 6 columns of textboxes and if I wanted to apply this to say just the 3rd column how would I change the code?

  • Re: Conditional Format Multiple Userform Textboxes dependent on value


    Assuming your text boxes are numbered incrementally from 1 to 52 (or whatever) then I presume the third column of text boxes is related to certain rows of cells... if so, you would just check the value of r (the row counter for the cells) and calculate the text box number from this.

    _______________________________________________
    There are 10 types of people in the world. Those that understand Binary and those that dont. :P


    Why are Halloween and Christmas the same? Because Oct 31 = Dec 25... ;)

    _______________________________________________

Participate now!

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