Private
Sub
Worksheet_Change(
ByVal
Target
As
Range)
If
Intersect(Range(
"A41:A59"
), Target)
Is
Nothing
Then
Exit
Sub
If
Target.Value <>
"x"
Then
Exit
Sub
Dim
c
As
Range, iColi
Set
c = Range(
"A40"
)
iColi = Target.Offset(-20).Interior.ColorIndex
If
c.Interior.ColorIndex = xlNone
Then
c.Interior.ColorIndex = iColi
ElseIf
c.Interior.ColorIndex <> 3
Then
c.Interior.ColorIndex = iColi
End
If
Set
c = Range(
"A41:A59"
).Find(
"x"
, Target, -4163, 1, , 1)
If
c.Address <> Target.Address
Then
Application.EnableEvents =
False
c.Value =
""
Application.EnableEvents =
True
End
If
End
Sub