View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default Conditional Formatting Help!

Paste the following event code into the code module for the sheet where you
want this formatting to occur:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("A1:CM190")) Is Nothing Then Exit Sub
Select Case Target.Value
Case 1
Target.Font.ColorIndex = 6
Target.Interior.ColorIndex = 6
Case 2
Target.Font.ColorIndex = 46
Target.Interior.ColorIndex = 46
Case 3
Target.Font.ColorIndex = 37
Target.Interior.ColorIndex = 37
Case 4
Target.Font.ColorIndex = 5
Target.Interior.ColorIndex = 5
Case 5
Target.Font.ColorIndex = 3
Target.Interior.ColorIndex = 3
Case Else
Target.Font.ColorIndex = xlColorIndexAutomatic
Target.Interior.ColorIndex = xlColorIndexAutomatic
End Select
End Sub

By setting the font colorindex and the interior colorindex to the same
value, you can't see what is entered in the cell. Is that what you intended?

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Hope this helps,

Hutch

" wrote:

I need to apply CF macro to my 2003 since I need to have 5
conditions. I know that I can download addins but I am working from a
secure network without internet access.

The range is A1:CM190. Here are my conditions

If the cell value is 1, then the font and internior color index is 6
'yellow'
If the cell value is 2, then the font and internior color index is 46
'Orange'
If the cell value is 3, then the font and internior color index is 37
'blue'
If the cell value is 4, then the font and internior color index is 5
'Dark blue'
If the cell value is 5, then the font and internior color index is 3
'red'

Any help I can get is highly appreciated!!!

Thanks!