When I scan my item bar code in my input field (megBox) my for loop does not Find/Match my item.
It keeps saying "item not found".
It only finds this item(21603000815) and prints "Found value on row 1". (which in only one of the many items)
everything else returns:"item not found"
how can it find the other items?
Sub findIt()
Dim i As Long
Dim x As Integer, y As Integer, q As Integer
Worksheets(3).Activate
With Worksheets(3).Range("a1:d12") 'looking in sheet with all items
x = 0
Do While xforms <> -1
xforms = Application.InputBox("Enter Barcode", xTitleId, "", Type:=1)
Application.Visible = True
For q = 1 To 500 ' Revise the 500 to include all of your values
If Worksheets(3).Cells(q, 2).Value = xforms Or Worksheets(3).Cells(q, 2).Formula = xforms Then
MsgBox ("Found value on row " & q)
Application.Visible = True
GoTo skip
Else
MsgBox ("item Not Found")
Exit Sub
End If
Next q
skip:
' This MsgBox will only show if the loop completes with no success
MsgBox ("yessssssssssss")
Worksheets("Barcodes").Range("a1").Offset(y, 0).Value = xforms 'putting items/barcord in a seperate tad to check for dupliate items
Set c = .Find(xforms, LookIn:=xlValues)
c.Select
i = ActiveCell.Row
Rows(i).Select
Selection.Copy Worksheets("Shop Lable Info").Range("a1").Offset(x, 0)
Rows(i + 1).Select
Selection.Copy Worksheets("Shop Lable Info").Range("a2").Offset(x, 0)
x = x + 2
y = y + 1
Loop
End With
End Sub