Hi I have written a very simple piece of code, which looks up a Batch Number, and then if found it pulls through the Job Number and Date of manufacture
the issue with this is that if the batch number does not exist, it simply pulls though no data. I would like a messagebox to then pop up saying "Batch Number not found"
Any help would be appreciated. See code below:
the issue with this is that if the batch number does not exist, it simply pulls though no data. I would like a messagebox to then pop up saying "Batch Number not found"
Any help would be appreciated. See code below:
VBA Code:
Private Sub BatchNo_AfterUpdate()
Dim MyTableArray As Range
Set MyTableArray = Sheets("SafetyValveData").Range("A:F")
On Error GoTo err_trap
'vlookup batch no
Me.JobNo.Value = WorksheetFunction.VLookup(Me.BatchNo.Value, MyTableArray, 4, 0)
Me.DateOfManufacture.Value = WorksheetFunction.VLookup(Me.BatchNo.Value, MyTableArray, 5, 0)
err_trap:
Exit Sub
End Sub