Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help with code

2 views
Skip to first unread message

Greg B

unread,
Jul 10, 2008, 12:34:31 PM7/10/08
to
I am having trouble with a piece of code, the code works with smaller
numbers but when I scan a barcode it does not recognise the number? What
have I got wrong here is the code below.
Private Sub UserForm_Activate()

TextBox1.Value = InputBox("PLEASE SCAN THE ITEM")


End Sub

Private Sub TextBox1_Change()

Dim CHECK1
Sheet5.Activate
On Error Resume Next
CHECK1 = Application.Match(CLng(TextBox1.Value), Range("A:A"), 0)
If Not IsError(CHECK1) Then
Label1.Caption = Application.Index(Range("B:B"), CHECK1)
End If
On Error GoTo 0

End Sub

Dick Kusleika

unread,
Jul 10, 2008, 1:37:55 PM7/10/08
to
On Fri, 11 Jul 2008 02:04:31 +0930, "Greg B" <little...@ihug.com.au>
wrote:

Do you mean like barcodes with more than 15 characters. Excel has a 15
character precision limit, so a "number" that's longer than 15 digits will
be truncated. However, you would not have numbers like that in column A
because it's still Excel. I'd bet that the long barcodes in column A are
really strings and getting rid of the CLng call would help you match them
(but break the small numbers).
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com

0 new messages