Color

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
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" 來函:
 
If those two colors are your only choices, color B1 blue then select it and
Format>Conditional Formatting>Condition1>Formula is:

=IF(A1>100,A1<200)

Format to red and OK.


Gord Dibben MS Excel MVP
 
Back
Top