View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Cell colour doesn't delete

Glad to help

--
Don Guillett
SalesAid Software

"Sandy" wrote in message
...
Thanks all, Don's suggestion is good for what I want.
Sandy

"Sandy" wrote in message
...
I have the folloing code, why does the cell color in cell C10 not delete
when the value of cell C8 is ""?
Thanks Sandy

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

Application.ScreenUpdating = False

Application.EnableEvents = False

For Each mycell In Range("C8:K8,M8:U8")
With mycell
If mycell.Value = "" Then
.Interior.ColorIndex = 36
.Font.ColorIndex = 1
.BorderAround LineStyle:=xlContinuous, Weight:=xlThin,
ColorIndex:=11
ElseIf mycell.Value < "" Then
.Interior.ColorIndex = 11
.Font.ColorIndex = 45
.Borders.LineStyle = xlNone
End If
End With

With mycell.Offset(2)
If mycell.Value = 0 Then
.Interior.ColorIndex = 11
.Value = ""
ElseIf mycell.Value 0 Then
.Interior.ColorIndex = 36
.Font.ColorIndex = 1
ElseIf mycell.Value = "" Then
.Interior.ColorIndex = xlColorIndexNone
.Value = ""
End If
End With
Next mycell

Application.ScreenUpdating = True

Application.EnableEvents = True

End Sub