colouring a cell

A

andy617

I would like a cell from a range to change colour whenever some text is
entered into it.
For example, if I type in a date or text like 'yes or no' into a cell
ranging from F4:F44 then it will turn the cell colour yellow.

Could anyone offer any help on this.

Thanks
 
G

Guest

andy617 said:
I would like a cell from a range to change colour whenever some text is
entered into it.
For example, if I type in a date or text like 'yes or no' into a cell
ranging from F4:F44 then it will turn the cell colour yellow.

Could anyone offer any help on this.

Thanks
 
G

Guest

Here is what I did for an application I wrote. Hope it helps and is useful:

Public pubColors(9) As Integer

Sub some_process1()
Dim idxColors As Integer

' load up the pubColors array
' 0 = Black
' 1 = Black
' 2 = White
' 3 = Red
' 4 = Bright Green
' 5 = Blue
' 6 = Yellow
' 7 = Magenta
' 8 = Cyan
' 9 = Brown
For idxColors = 0 To 9
pubColors(idxColors) = idxColors
Next idxColors

Call some_process2()
End Sub

Sub some_process2()
Dim MyColor As Integer

MyColor = 3
Call Color_It(MyColor)
End Sub

Sub some_process2()
If [Feb05_SOD_Closed] < [Jan05_SOD_Closed] Then
[Feb05_SOD_Closed].Font.ColorIndex = MyColor
End If
If [Mar05_SOD_Closed] < [Feb05_SOD_Closed] Then
[Mar05_SOD_Closed].Font.ColorIndex = MyColor
End If
If [Apr05_SOD_Closed] < [Mar05_SOD_Closed] Then
[Apr05_SOD_Closed].Font.ColorIndex = MyColor
End If
If [May05_SOD_Closed] < [Apr05_SOD_Closed] Then
[May05_SOD_Closed].Font.ColorIndex = MyColor
End If
If [Jun05_SOD_Closed] < [May05_SOD_Closed] Then
[Jun05_SOD_Closed].Font.ColorIndex = MyColor
End If
If [Jul05_SOD_Closed] < [Jun05_SOD_Closed] Then
[Jul05_SOD_Closed].Font.ColorIndex = MyColor
End If
If [Aug05_SOD_Closed] < [Jul05_SOD_Closed] Then
[Aug05_SOD_Closed].Font.ColorIndex = MyColor
End If
If [Sept05_SOD_Closed] < [Aug05_SOD_Closed] Then
[Sept05_SOD_Closed].Font.ColorIndex = MyColor
End If
If [Oct05_SOD_Closed] < [Sept05_SOD_Closed] Then
[Oct05_SOD_Closed].Font.ColorIndex = MyColor
End If
If [Nov05_SOD_Closed] < [Oct05_SOD_Closed] Then
[Nov05_SOD_Closed].Font.ColorIndex = MyColor
End If
If [Dec05_SOD_Closed] < [Nov05_SOD_Closed] Then
[Dec05_SOD_Closed].Font.ColorIndex = MyColor
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