ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Barcode Scanner (https://www.excelbanter.com/excel-programming/430694-barcode-scanner.html)

Greg B[_17_]

Barcode Scanner
 
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




joel

Barcode Scanner
 
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

"Greg B" wrote:

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






All times are GMT +1. The time now is 02:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com