I have a form that will search for an entered in UPC code which almost always starts with a 0. On my spreadsheet I have labeled Data and the cells are formatted as Text so the 0's show up and the next column is the description of the item.
When the user enters in the UPC number my next text box should automatically enter in the item description but it is not working it is pulling up the error message I have programmed in my code.
Someone Please help me with this code.
Private Sub UPCNum_Change()
When the user enters in the UPC number my next text box should automatically enter in the item description but it is not working it is pulling up the error message I have programmed in my code.
Someone Please help me with this code.
Private Sub UPCNum_Change()
Code:
If Len(UPCNum.Text) >= 12 Then
On Error Resume Next
x = Application.WorksheetFunction. _
VLookup(CDbl(UPCNum.Text), Worksheets("Data").Range("A2:E50000"), 2, False)
If Err.Number = 0 Then
Description = x
Else
Description = "No such product found"
End If
On Error GoTo 0
End If
End Sub