+ Reply to Thread
Results 1 to 5 of 5

VBScript to change color of target if range color is same

  1. #1
    Registered User
    Join Date
    12-02-2008
    Location
    Michigan
    Posts
    3

    VBScript to change color of target if range color is same

    Hello all,

    I am in a bit of a pinch. I have created a spreadsheet in which a minimum and maximum tolerance is established off of an entered value and is displayed on each side of said value (IE - C9 = Min, D9 = Entered Value, E9 = Max).

    I have also added conditional formatting so when the min and max are identified, it will automatically color the entered value cell green if it is within limits, or red if it is not.

    My Question is that I have several sets of data (17 to be exact) and I would like to make a script to automatically check or color a separate cell if all of the entered value cells turn green and fall within the limits, or check a different cell if there is one or more cells that is red.

    Unfortunately I am completely lost with this and I don't know where to start. Any help would be appreciated.

    Thanks!

    -Matt

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    First, do you really mean VBScript, or VBA? They are different...

    Second, there's no need for any programming; conditional formatting can do this.

    Post a workbook?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    12-02-2008
    Location
    Michigan
    Posts
    3
    First off, I meant VBA. Secondly if there is any way to do this with conditional formatting I would love to know.

    I have attached a sample of what I am talking about. Unfortunately I can't attach the actual file as it is sensitive information.

    I would like to know how to get the "Unit Accept" box to either be colored in, or have a "x" put in it if all the Actuals are green. If one or more of the actuals are red, I would like the same thing to happen, but in the "Unit Reject" Box.
    Attached Files Attached Files

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    In B32, this array formula: =IF(AND($D$9:$D$25 >= $C$9:$C$25, $D$9:$D$25 <= $E$9:$E$25), "x", "")

    Array formulas MUST be confirmed with Ctrl+Shift+Enter, not Enter. You'll know you did it correctly if curly braces appear around the formula in the Formula Bar; you cannot type in the braces directly.

    If you were using named ranges, this becomes more intuitive:

    =if( and(values >= valMin, values <= valMax), "x", "")

    In B33, =IF(B32="x", "", "x")
    Last edited by shg; 12-02-2008 at 12:24 PM.

  5. #5
    Registered User
    Join Date
    12-02-2008
    Location
    Michigan
    Posts
    3
    Ahhh great, thanks for the help. Instead of basing it off the colors I should have just done that to begin with!

    Thanks,

    -Matt

+ 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