Barcode Scanner

G

Greg B

Hi I have a question, I have fair knowledge of excel but I am trying to
build a userform which can be used as a interface with the database I have
created.
The trouble I am having is I have the following code to look up some
information and it gives me the item I am looking for. But if I use the
barcode scanner and scan the proper barcode on the item it does not
recognise it at all.

Why is this and how can I fix it thanks in advance

Greg B


Dim ansD3
Sheet1.Activate
On Error Resume Next
ansD3 = Application.Match(CLng(bcscan.value), Range("A:A"), 0)
If Not IsError(ansD3) Then
itembox.value = Application.Index(Range("b:b"), ansD3)
End If
On Error GoTo 0
 
J

Joel

Why use a worksheet function match when you can do it more eficiently in VBA

with sheets("Sheet1")
Data = CLng(bcscan.value)
set c = .Columns("A").find(what:=Data, _
lookin:=xlvalues, lookat:=xlwhole)
if not c is nothing then
itembox.value = c.offset(0,1)
end if
end with
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top