![]() |
Color
Could someone please show me the way to have a cell color changed based on
the condition of another cell. For example, if A1 100 and < 200 then B1's color is red else blue. Thank you. |
Color
Sub colorChange()
If Range("A1").Value 100 Then If Range("A1").Value < 200 Then Range("B1").Interior.ColorIndex = 3 Else Range("B1").Interior.ColorIndex = 11 End If End If End Sub "AlanW" wrote: Could someone please show me the way to have a cell color changed based on the condition of another cell. For example, if A1 100 and < 200 then B1's color is red else blue. Thank you. |
Color
Mike,
Other than the programming you mentioned, can I just simply use IF THEN ELSE function in the worksheet to do it. Thank you "Mike" 來函: Sub colorChange() If Range("A1").Value 100 Then If Range("A1").Value < 200 Then Range("B1").Interior.ColorIndex = 3 Else Range("B1").Interior.ColorIndex = 11 End If End If End Sub "AlanW" wrote: Could someone please show me the way to have a cell color changed based on the condition of another cell. For example, if A1 100 and < 200 then B1's color is red else blue. Thank you. |
Color
If those two colors are your only choices, color B1 blue then select it and
FormatConditional FormattingCondition1Formula is: =IF(A1100,A1<200) Format to red and OK. Gord Dibben MS Excel MVP On Sun, 15 Jul 2007 08:26:01 -0700, AlanW wrote: Mike, Other than the programming you mentioned, can I just simply use IF THEN ELSE function in the worksheet to do it. Thank you "Mike" ??? Sub colorChange() If Range("A1").Value 100 Then If Range("A1").Value < 200 Then Range("B1").Interior.ColorIndex = 3 Else Range("B1").Interior.ColorIndex = 11 End If End If End Sub "AlanW" wrote: Could someone please show me the way to have a cell color changed based on the condition of another cell. For example, if A1 100 and < 200 then B1's color is red else blue. Thank you. |
All times are GMT +1. The time now is 08:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com