Thread: Colored Cell
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
brownti via OfficeKB.com brownti via OfficeKB.com is offline
external usenet poster
 
Posts: 103
Default Colored Cell

Ok, i got it working, sort of.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Dim rnginput As Variant
Set rnginput = Intersect(Target, Range("e:e"))
If rnginput Is Nothing Then Exit Sub
For Each rng In rnginput
Select Case rng.Value
Case 0: Target.Offset(0, -3).Interior.ColorIndex = 10
Case Else: Target.Offset(0, -3).Interior.ColorIndex = xlColorIndexNone
End Select
rng.Interior.ColorIndex = Num
Next rng
End Sub

But now i need to do that 5 more times. Now i need if range "f:f" is 0,
offset (0,-5).interior.colorindex=40


Ron de Bruin wrote:
Sorry that I not understand you (Dutch people are not so smart)

needs. If B1=0, A1 should be red, if B1 doesnt equal 0, go to next row.


Go to the next row and then ?

I need to use six different colors...


Where do you use these colors then

That doesnt work for me. I dont understand. I feel like i a loop would be
easier, i just cant get it to work. It only has two different conditions it

[quoted text clipped - 24 lines]
consecutive cells. Probably be easiest if it just happens when the workbook
is opened. Thanks in advance for any help.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200702/1