Results 1 to 4 of 4

Multiple Color Conditions

Threaded View

  1. #1
    Forum Contributor
    Join Date
    04-02-2008
    Location
    Jacksonville Beach, Florida
    MS-Off Ver
    Microsoft Excel 2003 and 2010
    Posts
    264

    Multiple Color Conditions

    The code below works perfect except I want to highlight other cells in the same row where the text in column D equals one of the item#s (eg, Item1, Item2, etc). So for example, at this point, if cell D10 equals Item4, then it will be color shaded whatever # 36 is on the Excel pallette. I want that to happen but to also have A10, B10, C10, E10, F10, - L10 shaded the same color (#36). Is there a simple code change I can make?
    Private Sub Worksheet_Calculate()
    Dim oCell As Range
        For Each oCell In Range("D3:D50")
            Select Case oCell.Value
                 Case Is < 1
                     oCell.Interior.ColorIndex = xlNone
                 Case Is = "Item1"
                     oCell.Interior.ColorIndex = 24
                 Case Is = "Item2"
                     oCell.Interior.ColorIndex = 14
                 Case Is = Item3"
                     oCell.Interior.ColorIndex = 34
                 Case Is = "Item4"
                     oCell.Interior.ColorIndex = 36
                 Case Is = "Item5"
                     oCell.Interior.ColorIndex = 17
                 Case Is = "Item6"
                     oCell.Interior.ColorIndex = 15
                 Case Is = "Item7"
                     oCell.Interior.ColorIndex = 40
                 Case Is > 7
                     oCell.Interior.ColorIndex = xlNone
             End Select
        Next oCell
    End Sub
    Last edited by dreicer_Jarr; 09-16-2010 at 03:55 PM.
    ______________________________________
    "Vision without Execution is a Hallucination"
    Edison

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