Hello,
I have a worksheet that contains Product details (BarCode, Name, Category...)
I have the following code to lookup the name reference to the entered BarCode
It works well if the number is less than 10 digits
Ex: if I entered this number in the "txtBarCode", it will lookup the name and all details, but if the number is "1234567899" (10 digits, the name box will be null)
Can someone help me fixing this problem please?
I tried both ways (Find & Vlookup)
Private Sub txtBarCode_Change()
With Sheet1.Range("A4").CurrentRegion
Set fvalue = .Find(What:=txtBarCode.value, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
End With
With Me
.txtItemName = fvalue.Offset(, 1).value
End With
'With Me
'.txtItemName = Application.WorksheetFunction.VLookup(CLng(Me.txtBarCode), Sheet1.Range("A4").CurrentRegion, 2, 0)
'End With
End Sub
I have a worksheet that contains Product details (BarCode, Name, Category...)
I have the following code to lookup the name reference to the entered BarCode
It works well if the number is less than 10 digits
Ex: if I entered this number in the "txtBarCode", it will lookup the name and all details, but if the number is "1234567899" (10 digits, the name box will be null)
Can someone help me fixing this problem please?
I tried both ways (Find & Vlookup)
Private Sub txtBarCode_Change()
With Sheet1.Range("A4").CurrentRegion
Set fvalue = .Find(What:=txtBarCode.value, LookIn:=xlValues, lookat:=xlWhole, MatchCase:=False)
End With
With Me
.txtItemName = fvalue.Offset(, 1).value
End With
'With Me
'.txtItemName = Application.WorksheetFunction.VLookup(CLng(Me.txtBarCode), Sheet1.Range("A4").CurrentRegion, 2, 0)
'End With
End Sub