Worksheet_Change Woes
Hi Mick,
Am Fri, 27 Sep 2013 23:11:10 -0700 (PDT) schrieb Living the Dream:
If IsNumeric(Target.Value) Then
With Target
.Offset(, -10).Resize(, 14).Interior.ColorIndex = 6
.Offset(, -9).Select
End With
if your target is empty the value is 0. And 0 is also numeric. Therefore
you get in both conditions the yellow background.
Change the order of the conditions. Set IsEmpty as first condition:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myC As Integer
If Target.Row < 5 Or Target.Column < 11 Then Exit Sub
If IsEmpty(Target) Then
myC = 0
ElseIf IsNumeric(Target) Then
myC = 6
End If
With Target
.Offset(, -10).Resize(, 14).Interior.ColorIndex = myC
lookfor = .Offset(, -9)
End With
If myC = 6 Then
Plus_Chep_Out
Else
Minus_Chep_Out
End If
End Sub
Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
|