+ Reply to Thread
Results 1 to 7 of 7

Thread: Colour changing cells

  1. #1
    Registered User
    Join Date
    05-17-2011
    Location
    Pta, South Africa
    MS-Off Ver
    Excel 2003
    Posts
    2

    Colour changing cells

    I need some cells to change colour depending on a condition.
    If the cell reads "OK" it must be green and if it reads "Order!" it must be red.

    Example attached.

    Help please?
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    504

    Re: Colour changing cells

    Conditional formating is for this purpose.
    regards

    johnjohns

    When you are not sure where to go, every road takes you there!

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    6,213

    Re: Colour changing cells

    1. Paint cell as Red color
    2. Conditional formatting -> New Rule -> Format cell that contain -> Cell value, equal to, "OK" -> format (green cell)

    (P.S. Your profile said you using XL 2003 but example is newer version).
    Attached Files Attached Files
    "Relax. What is mind? No matter. What is matter? Never mind!"

  4. #4
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    703

    Re: Colour changing cells

    Hi,

    Assuming the value checked for is allways in column f

    Sub test()
    
    Dim CurCell As Object
    
    
    For Each CurCell In Range("F1:F20") ' adjust to langht of stock
    If CurCell.Value = "OK" Then
    CurCell.Select
    With Selection.Interior
    .Color = 5296274
    End With
    ElseIf CurCell.Value = "Order" Then
    CurCell.Select
    With Selection.Interior
    .Color = 255
    End With
    End If
    Next
    
    
    End Sub
    Steffen Thomsen

  5. #5
    Registered User
    Join Date
    05-16-2011
    Location
    Bucharest
    MS-Off Ver
    Excel 2003
    Posts
    32

    Wink Re: Colour changing cells

    [QUOTE=ahav;2526886]I need some cells to change colour depending on a condition.
    If the cell reads "OK" it must be green and if it reads "Order!" it must be red.
    QUOTE]

    Because your file is in excel 2007 I cand't open and I've atached one of mine.
    In the file atached try to type OK or Order in the first 35 cels (A2-A35) and see what happens
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor johnjohns's Avatar
    Join Date
    11-19-2007
    Location
    Dubai, UAE
    MS-Off Ver
    2003 and 2007
    Posts
    504

    Re: Colour changing cells

    Again, I think Zbor gave the shortest, simple most solution. Filling the cell with Red color first and then using conditional formatting, change the color to green, if the cell value is "OK". That is the easiest.
    regards

    johnjohns

    When you are not sure where to go, every road takes you there!

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    6,213

    Re: Colour changing cells

    Thx johnjohns.

    Always when there a 2 criterias (possible) one formatting should be default and other solved by CF.
    that's how resources are saved.
    "Relax. What is mind? No matter. What is matter? Never mind!"

+ 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.2.0