View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
cmcfalls[_2_] cmcfalls[_2_] is offline
external usenet poster
 
Posts: 1
Default VBA Conditional Formatting

Almost there guys....this code below works fine, but it colors th
entire row instead of the specific cell (I want cell I4, I5, I6, etc
only colored). Where's my error?

Private Sub Worksheet_Change(ByVal Target As Range)
' Conditional Formatting for more than 3 conditions

Dim rng As Range

Set rng = Intersect(Target, Range("I:I"))
If rng Is Nothing Then
Exit Sub
Else
Dim cl As Range
For Each cl In rng
Select Case cl.Text
Case "Returned"
cl.EntireRow.Interior.ColorIndex = 35
Case "Corrected & Returned"
cl.EntireRow.Interior.ColorIndex = 35
Case "Corrected, Not Yet Returned"
cl.EntireRow.Interior.ColorIndex = 3
Case "Completed, Not Yet Returned"
cl.EntireRow.Interior.ColorIndex = 3
Case "Received, Not Yet Completed"
cl.EntireRow.Interior.ColorIndex = 3
Case "Not Yet Received"
cl.EntireRow.Interior.ColorIndex = 3
Case "Violation: See Notes"
cl.EntireRow.Interior.ColorIndex = 36
Case Else
cl.EntireRow.Interior.ColorIndex = 0
Exit Sub
End Select
Next cl
End If

End Su

--
Message posted from http://www.ExcelForum.com