5 Conditions

A

Alexander Bryson

I have set up 4 conditions in Excel based on the following

If a certain cell is
0, <95, Re
/=95, <100, Orang
=/>100 and =/<110, Gree

0 - there is no condition - whit

I would like to add another - condition which is

Does anyone know how to do this?
 
J

JE McGimpsey

If you're referring to background colors, rather than fonts, you'll have
to use an event macro. One way:

Put this in the worksheet code module (right-click on the worksheet tab
and choose View Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("A1")) Is Nothing Then
With Range("A1")
If IsNumeric(.Value) Then
Select Case .Value
Case Is > 110
.Interior.ColorIndex = 5 'blue
Case Is >= 100
.Interior.ColorIndex = 10 'green
Case Is >= 95
.Interior.ColorIndex = 46 'orange
Case Else
.Interior.ColorIndex = 2 'white
End Select
Else
.Interior.ColorIndex = xlColorIndexNone
End If
End With
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top