View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chris Chris is offline
external usenet poster
 
Posts: 16
Default Help for a macro change cell colour under many conditions

Think you are looking for something like this.

Sub Collor()

Dim Rng As Range


With Worksheets("blad1")
Set Rng = Range("A1:D12") ''your range where to lool

End With
Dim CL As Object

Selection.Cells(1).Select
Rng.Select
Selection.Interior.ColorIndex = xlNone

For Each CL In Selection.Cells
Select Case CL.Value
Case (a 1 And c < 1)
CL.Interior.ColorIndex = 3
Case (a < 1 And d < 1)
CL.Interior.ColorIndex = 4

Case Else '----- color red = 3
CL.Interior.ColorIndex = xlNone
End Select
Next

'----- color white = 2
'----- color Green = 4

Selection.Cells(1).Select

End Sub

Chris