Home |
Search |
Today's Posts |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
not sure if you have any other code or what you do to change your data, but if
you paste this on the worksheet code page, it may work for you in the vb editor, right click the worksheet and click view code, then paste it. Private Sub Worksheet_Change(ByVal Target As Range) Dim ws As Worksheet Dim i As Long Dim rng As Range Dim icolor As Long Dim lastrow As Long Set ws = Worksheets("Sheet1") lastrow = ws.Cells(Rows.Count, "M").End(xlUp).Row For i = 2 To lastrow With ws.Range("M" & i) Select Case UCase(.Value) Case "BELOW" icolor = 3 Case "AT RISK" icolor = 6 Case "MEETS" icolor = 4 Case "EXCEEDS" icolor = 5 Case Else icolor = 0 End Select .Interior.ColorIndex = icolor End With Next End Sub -- Gary "Walt Herman" wrote in message ... would i paste this into a worksheet change event to effect the automatic apsects of it? can you help? sorry.... "Gary Keramidas" wrote: you can give this a try. change the worksheet name and the column letter. you may also want to change the shades of the colors. Sub Var_Colors() Dim ws As Worksheet Dim i As Long Dim icolor As Long Dim lastrow As Long Set ws = Worksheets("Sheet1") lastrow = ws.Cells(Rows.Count, "C").End(xlUp).Row For i = 2 To lastrow With ws.Range("C" & lastrow) Select Case UCase(.Value) Case "BELOW" icolor = 3 Case "AT RISK" icolor = 6 Case "MEETS" icolor = 4 Case "EXCEEDS" icolor = 5 End Select .Interior.ColorIndex = icolor End With Next End Sub -- Gary "Walt Herman" wrote in message ... Ok, I honestly spent a good half hour trying to find a posting which approximated what I wanted to do and have run out of patience. Can someone please help me? I have a variance report with a column that evaluates the results of each variance. There are 4 distinct values: Below, Meets, Exceeds, At Risk. I need the fill color for each of these values to change automatically as the evaluation changes. The rules for the fill color a "Below" should be RED, "At Risk" should be YELLOW, "Meets" should be GREEN, and "Exceeds" should be BLUE. I am sure there needs to be a case statement but really seem to be challenged in writing the code. I appreciate any help you can provide. Regards, Walt |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
color fill button is not adding color to my spread sheet | Excel Worksheet Functions | |||
change fill color of a range of cells based on color of a cell? | Excel Programming | |||
My fill color and font color do not work in Excel Std Edition 2003 | Excel Discussion (Misc queries) | |||
Excel 2003 will not display color fonts or color fill cells | Excel Worksheet Functions | |||
My excel 2003 wont let me fill cells with color or color the tabs. | New Users to Excel |