View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Conditional Formatting More Than three

Private Sub Worksheet_Change(ByVal Target As Range)
Dim R As Range
Dim iColor As Long
Set R = Range("D1:D100") 'adjust to suit
If Intersect(Target, R) Is Nothing Or _
Target.Count 1 Then Exit Sub
Vals = Array("WEST", "EAST", "NORTH", "SOUTH")
Nums = Array(3, 5, 10, 6)
For i = LBound(Vals) To UBound(Vals)
With Target
If UCase(.Value) = Vals(i) Then iColor = Nums(i)
If UCase(.Value) = Vals(i) Then .Font.Bold = True
End With
Next
With Target
.Interior.ColorIndex = iColor
End With
End Sub

Pasted into the sheet module.


Gord Dibben MS Excel MVP

On Thu, 25 Dec 2008 08:29:00 -0800, Bob
wrote:

What is the code to change the font to bold and also the color In a range in
Column D for five or six different conditions? For example:

West change to RED
East Change to BLUE
North Change to Green
Central Change to Yellow

Thanks in advance.