Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Sub whatColor() Dim c As Range target = Range("C2").Value lyrslts = Range("D2").Value lr = Cells(Rows.Count, 1).End(xlUp).Row Set fRng = Worksheets(1).Range("A2:A" & lr) For Each c In fRng If c.Value = target And c.Value = lyrslts Then c.Interior.ColorIndex = 4 ElseIf c.Value < target And c.Value = lyrslts Then c.Interior.ColorIndex = 6 ElseIf c.Value < target And c.Value < lyrslts Then c.Interior.ColorIndex = 3 End If Next End Sub " wrote: Hi, I am trying to conditionally format my worksheet based on the following conditions: If cell value = target and cell value = last year's result then color cell green If cell value < target and cell value = last years' result then color cell yellow If cell value < target and cell value < last year's result then color cell red I know you have to do this with vb but I am only a beginner and am not sure where to start. Also the target value is stored in a cell but it changes based on the data element that is looked at. If you could get me started that would be great. Thanks, Jaime |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formatting Conditional Formatting Icon Sets | Excel Discussion (Misc queries) | |||
Protect Cell Formatting including Conditional Formatting | Excel Discussion (Misc queries) | |||
conditional Formatting based on cell formatting | Excel Worksheet Functions | |||
conditional Formatting based on cell formatting | Excel Worksheet Functions | |||
Conditional Formatting that will display conditional data | Excel Worksheet Functions |