Sub x()
Dim rFind As Range, sFind, s As String
line1:
sFind = Application.InputBox("Enter bar code", , , , , , , 2)
If sFind = False Then Exit Sub
With Sheet1.Range("E2", Sheet1.Range("E2").End(xlDown))
Set rFind = .Find(What:=sFind, LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
If rFind Is Nothing Then
s = MsgBox("ID does not exist- try again?", vbYesNo)
If s = vbNo Then Exit Sub
Else
If UCase(rFind.Offset(, 1)) = "YES" Then
MsgBox "Used previously"
Beep
Else
rFind.Offset(, 1) = "YES"
MsgBox "OK"
End If
End If
End With
GoTo line1
End Sub
|