View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default VBA Conditional Formatting

Hi
change all lines like
cl.EntireRow.Interior.ColorIndex = value
to
cl.Interior.ColorIndex = value

--
Regards
Frank Kabel
Frankfurt, Germany

Almost there guys....this code below works fine, but it colors the
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 Sub


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