V
Vickie********
The code below works for what it is supposed to do. This
request is for the second portion the two need to work
together.
Here you go.
Cells F14 and F16 (first and last names)if one or both are
filled in then cells F22 and F23(X) are made red if there
isn't an X in one or the other of them. If there is then
neither are red. If only one of the F14 or F16 Cells are
filled in, then which ever isn't is turned red along with
F22 or F23 if one or the other of these cell doesn't have
an X in it. If there is and X in either F22 or F23 but
only one of the F14 or F16 cell is filled in the one with
out any input is made red.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$F$14" Or _
Target.Address = "$F$16" Then
If Target <> "" Then
Target.Interior.ColorIndex = xlNone
ElseIf Target = "" And _
UCase(Range("F22").Value) = "X" Or _
UCase(Range("F23").Value) = "X" Then
Target.Interior.ColorIndex = 3
Else
Target.Interior.ColorIndex = xlNone
End If
End If
If Target.Address = "$F$23" Or _
Target.Address = "$F$22" Then
If UCase(Target.Value) <> "X" Then
Application.EnableEvents = False
Target.ClearContents
Application.EnableEvents = True
If Range("F22") = "" And _
Range("F23") = "" Then _
Range("F14,F16").Interior.ColorIndex = xlNone
Else
If Range("F14").Value = "" Then
Range("F14").Interior.ColorIndex = 3
Else
Range("F14").Interior.ColorIndex = xlNone
End If
If Range("F16").Value = "" Then
Range("F16").Interior.ColorIndex = 3
Else
Range("F16").Interior.ColorIndex = xlNone
End If
End If
End If
End Sub
request is for the second portion the two need to work
together.
Here you go.
Cells F14 and F16 (first and last names)if one or both are
filled in then cells F22 and F23(X) are made red if there
isn't an X in one or the other of them. If there is then
neither are red. If only one of the F14 or F16 Cells are
filled in, then which ever isn't is turned red along with
F22 or F23 if one or the other of these cell doesn't have
an X in it. If there is and X in either F22 or F23 but
only one of the F14 or F16 cell is filled in the one with
out any input is made red.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$F$14" Or _
Target.Address = "$F$16" Then
If Target <> "" Then
Target.Interior.ColorIndex = xlNone
ElseIf Target = "" And _
UCase(Range("F22").Value) = "X" Or _
UCase(Range("F23").Value) = "X" Then
Target.Interior.ColorIndex = 3
Else
Target.Interior.ColorIndex = xlNone
End If
End If
If Target.Address = "$F$23" Or _
Target.Address = "$F$22" Then
If UCase(Target.Value) <> "X" Then
Application.EnableEvents = False
Target.ClearContents
Application.EnableEvents = True
If Range("F22") = "" And _
Range("F23") = "" Then _
Range("F14,F16").Interior.ColorIndex = xlNone
Else
If Range("F14").Value = "" Then
Range("F14").Interior.ColorIndex = 3
Else
Range("F14").Interior.ColorIndex = xlNone
End If
If Range("F16").Value = "" Then
Range("F16").Interior.ColorIndex = 3
Else
Range("F16").Interior.ColorIndex = xlNone
End If
End If
End If
End Sub