I have a code. It works well. However I need to make a change.
My code is based on having "completed" in column F
I cant figure out how to ADD a 2nd condition.
I need it to also have "Running Repair" in column E
Can someone please help?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim f As Range
Dim resp As VbMsgBoxResult
Dim i As Long
If Not Intersect(Target, Range("F:F")) Is Nothing Then
If Target.Count > 1 Then Exit Sub
If Target.Value = "Completed" Then
resp = MsgBox("Is unit returned to service?", _
vbYesNo + vbQuestion)
If resp = vbYes Then
Set f = Range("I:J").Find("RETURNED TO SERVICE", , xlValues, xlPart, , , False)
If Not f Is Nothing Then
i = f.Row + 2
Set f = Range("I:J").Find(Range("A" & Target.Row).Value, , xlValues, xlWhole, , , False)
If Not f Is Nothing Then
MsgBox "This unit already exists in the section."
Exit Sub
End If
Do While True
If Range("I" & i).Value = "" Then
Range("I" & i).Value = Range("A" & Target.Row).Value
Exit Do
End If
i = i + 1
Loop
End If
End If
End If
End If
End Sub
Bookmarks