View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Alternative to Conditional Formatting

give this a try, adjust the range to your liking

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Count = 1 Then
If Not Intersect(Target, Range("C1:C17")) Is Nothing Then

If UCase(Target) = "EMPTY" Or UCase(Target.Value) = "SOLD" Then

Target.Interior.ColorIndex = 35
Else
Target.Interior.ColorIndex = 0
End If
End If
End If
End Sub

--


Gary


"Bruise" wrote in message
...
Thanks, Gary. This does work. If I wanted the value to be a specific
text (i.e., "SOLD", or "EMPTY"), the IsNumber reference won't work. What
would be the one for text and how would I write that one?

Thanks again. This helps out a ton!

Mark


Gary Keramidas wrote:
see if you can adapt this. if c3 is a number, it will color c3:c7 green.
test it out. right click the sheet name, choose view code and paste it on
the sheet code page if you only want it on one sheet

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Range("c3:c7")
If Application.IsNumber(Range("c3")) Then

.Interior.ColorIndex = 35
Else
.Interior.ColorIndex = 0

End If
End With
End Sub