+ Reply to Thread
Results 1 to 3 of 3

Change Textbox Backcolor (multiple textboxes)

  1. #1
    Registered User
    Join Date
    09-10-2009
    Location
    Brighton,England
    MS-Off Ver
    Excel 2003
    Posts
    44

    Change Textbox Backcolor (multiple textboxes)

    Hi,

    I have 5 textboxes on a userform. I would like to be able to change the backcolor of all of them to be the same if one changes.

    I will try to explain this a little better

    The backcolor of each of the 5 textboxes can change if the value meets a criteria:

    If value less than 2 textbox is green (good - lowest score)
    If value between 3 and 4 textbox is orange (ok)
    If value is over 4 textbox is red.(bad - highest score)

    This is applied to each textbox individually and works fine. So I could have one red box, two orange and two green.

    What I would like to happen is this:

    If any of the boxes are red - all boxes need to go red.
    If there are no red boxes and one of the boxes is orange - all boxes need to go orange.


    Does anyone know if this is possible?
    Last edited by msommerf; 03-05-2010 at 10:52 AM.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Change Textbox Backcolor (multiple textboxes)

    If any of the boxes are red - all boxes need to go red.
    If there are no red boxes and one of the boxes is orange - all boxes need to go orange.
    What if the textboxes contain conflicting values, which one gets priority and decides the color to use?

    Since you didn't provide a workbook example, perhaps you can build off of the following.
    Assuming Textbox1 is used for inputting the value, then the other check boxes will change color per the value.

    Note: this is basic code - there are no checks for valid entries into Textbox1.

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

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Registered User
    Join Date
    09-10-2009
    Location
    Brighton,England
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: Change Textbox Backcolor (multiple textboxes)

    Many thanks for your help, this did the trick.

+ 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