View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Heiko Heiko is offline
external usenet poster
 
Posts: 16
Default Select Case for Conditional Formatting

Instead of

Case Is = Red

use

Case "Red"



"?B?Um9uUw==?=" wrote:

I've tried using the following code or more than three conditional formats, but it doesn't work.

Basically I want the background color to show red, green, yellow, or blue if the text in a cell says the same thing.

"Red" text would = red background
"Blue" text = blue backgroung

Any hints you can give me would be much apprepriated - Thanks

***** - five stars to anyone willing to give some feedback


Private Sub Worksheet_Calculate()
Dim oCell As Range
For Each oCell In Range("BF261:BF276")
Select Case oCell.Value
Case Is = Red
oCell.Interior.Pattern = xlColorIndexNone
oCell.Interior.PatternColorIndex = 3
Case Is = Blue
oCell.Interior.Pattern = xlColorIndexNone
oCell.Interior.PatternColorIndex = 5
Case Is = Green
oCell.Interior.Pattern = xlColorIndexNone
oCell.Interior.PatternColorIndex = 3
Case Is = Amber
oCell.Interior.Pattern = xlColorIndexNone
oCell.Interior.PatternColorIndex = 6
Case Is = Complete
oCell.Interior.Pattern = xlColorIndexNone
oCell.Interior.PatternColorIndex = 39
End Select
Next oCell
End Sub