Hi,

I'm creating some code that basiclly checks to see if a code is there before proceeding with the rest of the script. I can make it find existing codes and tell me that it's there but if I enter one that isn't there it freaks out and goes into debugging.

I need a way of stopping it from chucking a fit when the code doesn't already exist.

My current code is as follow;

Sub ChkJobNo()
Dim rval As Integer
'Number for Validating'
Dim strJobNo As String


'Checks the numbers in list'
    If Cells(1, 9) = 1 Then
        strJobNo = Cells(6, 2)



' Locates the Job No which is entered into the text box, used for the creation of new forms when there is already job details'
strJobNo = Cells(6, 2)
Sheets("Core").Select
Cells.find(What:=strJobNo, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False).Activate


If strJobNo = strJobNo Then MsgBox ("Job Number already exists!")
Sheets("Main").Select
End
If strJobNo = "" Then
Exit Sub

End If



End If
  
End Sub