Thread: So close
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
E2out E2out is offline
external usenet poster
 
Posts: 6
Default So close

So in other words I have to break up the conditional test?

(any number< cell value < bigger number)

I'm not trying to change "B2" twice. What I'm trying to do is change the
font color if the value lies in between the range or change it to the second
color if it doesn't

Again I have to be so close on this one...

Thanks again....

So I have to throw an "Else" in there?




"Dave Peterson" wrote in message
...
Sub nums()
Dim a As Integer
a = Worksheets("sheet1").Range("b2").Value
If 5 < a _
and a < 8 Then
'You're changing B2 twice??????
Worksheets("sheet1").Range("b2").Font.Color = RGB(255, 0, 0)
Worksheets("sheet1").Range("b2").Font.Color = RGB(0, 0, 255)
End If
End Sub

E2out wrote:

Can anyone help me out here? I want to change the font color of a cell
depending on a conditional test (4<cell contents<90)

Here is my code

Sub nums()
Worksheets("sheet1").Activate
Range("b2").Select
Range("b2").Activate
Dim a As Integer
a = Worksheets("sheet1").Range("b2").Value
If (5 < a < 8) Then
Worksheets("sheet1").Range("b2").Font.Color = RGB(255, 0, 0)
Worksheets("sheet1").Range("b2").Font.Color = RGB(0, 0, 255)
End If
End Sub

Thanks!

JP


--

Dave Peterson