(Msg. 1) Posted: Fri Jul 11, 2008 2:04 am
Post subject: Help with code Add to elertz Archived from groups: microsoft>public>excel>querydao (more info?)
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
(Msg. 2) Posted: Fri Jul 11, 2008 2:04 am
Post subject: Re: Help with code Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
>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
>
>
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
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum