+ Reply to Thread
Results 1 to 6 of 6

Change cell color based on two values

  1. #1
    Registered User
    Join Date
    08-20-2008
    Location
    Minnesota
    Posts
    7

    Change cell color based on two values

    Hi everyone

    I've got two values in A1 and B1 that represent limit values. When the user enters a value in C1 I need that cell background to change to red if it is outside A1 and B1 and green if it is in between.

    Due to some other code I have to use VBA and not conditional formatting.

    Probably an extremely easy question, but I'm terrible with VBA.

    I can do all of the logic (there are a few more cases that I can add in later) if I can get the proper code to:

    1)run the code when C1 is selected,
    2)compare the values
    3)and change the background color.

    Thanks,
    Jordan

  2. #2
    Registered User
    Join Date
    08-18-2008
    Location
    Singapore
    Posts
    79
    Hi there,

    Your description is vague.

    Could you provide more details? Or maybe an example attached?

  3. #3
    Registered User
    Join Date
    08-20-2008
    Location
    Minnesota
    Posts
    7
    I've got values in A1 and B1.

    When a value is entered in C1, the background of that cell needs to change to green if it is between A1 and B1. If the value is outside those two values it needs to change to red.

    As I said, I can't use conditional formatting for this because of some other code that references C1.

  4. #4
    Registered User
    Join Date
    08-18-2008
    Location
    Singapore
    Posts
    79
    Between A1 and B1 meaning A1 can be < B1 and B1 can be < than A1?

    And by outside of those two values do you mean not equal to those values or more than those values?

  5. #5
    Registered User
    Join Date
    08-20-2008
    Location
    Minnesota
    Posts
    7
    A1 will always be less than B1.

    I guess if C1 is equal to the limits I'll call it inside. C1 will always be a very precise value. We've never had it come up before.

  6. #6
    Registered User
    Join Date
    08-18-2008
    Location
    Singapore
    Posts
    79
    There:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Need an iterative cell entry and print for entire list of values.
    By jwhitwell in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-18-2008, 01:22 PM
  2. Iterate until cell values match
    By ArtZ in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-03-2008, 01:01 AM
  3. connecting formulas (not values)
    By RZBK in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-12-2008, 06:24 AM
  4. copying various cells in ot different cells in a different sheet
    By MonkeyDeath in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-25-2007, 11:22 AM
  5. Change Event doesn't change until I return to the Target Cell
    By carsto in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-11-2007, 05:20 PM

Tags for this Thread

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