Hi i am trying to make barcode reader in VBA
I have some problem any one can help me. and Error shown as Run-time error '6':
Private Sub UserForm_Click()
Private Sub Barcode_AfterUpdate()
If WorksheetFunction.CountIf(Sheet1.Range("E:E"), Me.barcode.Value) = 0 Then
MsgBox "Not Found"
Me.barcode.Value = ""
Exit Sub
End If
With Me
.brand = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 2, 0)
.size = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 3, 0)
.heigth = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 4, 0)
.Length = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 5, 0)
.width = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 6, 0)
.weigth = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 7, 0)
.crop = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 8, 0)
End With
End Sub
I have some problem any one can help me. and Error shown as Run-time error '6':
Private Sub UserForm_Click()
Private Sub Barcode_AfterUpdate()
If WorksheetFunction.CountIf(Sheet1.Range("E:E"), Me.barcode.Value) = 0 Then
MsgBox "Not Found"
Me.barcode.Value = ""
Exit Sub
End If
With Me
.brand = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 2, 0)
.size = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 3, 0)
.heigth = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 4, 0)
.Length = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 5, 0)
.width = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 6, 0)
.weigth = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 7, 0)
.crop = Application.WorksheetFunction.VLookup(CLng(Me.barcode), Sheet1.Range("E:L"), 8, 0)
End With
End Sub