IF and colors

  • Thread starter Thread starter tsf929
  • Start date Start date
T

tsf929

Is it possible to do the following: IF cell A1=100,current cell turn
the color red?, also could it be set up so IF cell A1=100, cell B1 an
C1 turn red? I don't think I can use the conditional formating becaus
i have about 8 different values and conditional formatting only work
for the first 3 as far as I know.

Thanks,


Travi
 
Select A1,B1,C1

Goto Format>Conditional Formatting
Select a condition of Formula Is
Add a formula of =$A$1=100
Click the Format button and format to your needs
OK
OK

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
I know conditional formatting can do it, however what if i have 5
values? is there a way around the 3 limit on conditional format? for
example:



A1=100 I want B1 and A1 to be RED
A1=125 I want B1 and A1 to be YELLOW
A1=150 I want B1 and A1 to be GREEN
A1=175 I want B1 and A1 to be PURPLE
A1=200 I want B1 and A1 to be BLUE

etc...

Is this possible?



Thanks,

Travis
 
It's possible with VBA.

This code goes in the worksheet code module (right-click on the sheet tab,
select the View Code option, and paste the code in)

Const colRed As Long = 3
Const colYellow As Long = 6
Const colBlue As Long = 5
Const colGreen As Long = 10
Const colPurple As Long = 13

Private Sub Worksheet_Change(ByVal Target As Range)

If Not Intersect(Target, Range("A1")) Is Nothing Then
With Target.Offset(0, 1).Interior
Select Case Target.Value
Case 100: .ColorIndex = colRed
Case 125: .ColorIndex = colYellow
Case 150: .ColorIndex = colGreen
Case 175: .ColorIndex = colPurple
Case 200: .ColorIndex = colBlue
End Select
End With
End If

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Bob,

Thanks so much, I got it pretty much working the way I want, just need
some more tweaking but I got the hang of it now thanks to you!




Travis
 
Back
Top