Vlookup in Textbox

faheem354

New Member
Joined
Dec 10, 2017
Messages
4
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
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,215,700
Messages
6,126,285
Members
449,308
Latest member
VerifiedBleachersAttendee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top