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
 

Some videos you may like

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Watch MrExcel Video

Forum statistics

Threads
1,109,337
Messages
5,528,113
Members
409,802
Latest member
joeino

This Week's Hot Topics

  • Change military grades into rank
    Afternoon all Need help with formula that will change military rank (i.e. 1, 2, 3 into Amn, A1C, SrA). Running IF formula that does not work...
  • VBA COUNTIF SOLUTION
    Hi The following are the errors spread across the several columns from E to Q ie. 13 columns across several sheets with more than 500 rows per...
  • INSERT ROW WITH SPECIFIS TEXT IN A COLUMN
    Hi All! How can identify that that the row to be inserted has to be inserted before 1st row with specific text in column F. If I record the...
  • Auto-Create a monthly Sign in sheet for preschool students
    The image below is what each page looks like. Above is space for the "Child Name" "Month" "Class" School days are obviously Monday-Friday but...
  • VBA vlookup multiple results
    Hi folks, Hopefully someone out there can help. I have a list to vlookup which works (ish). the lookup only picks up the first instance of the...
  • Extract values for earliest/latest times
    I am trying to put together a formula to get the earliest start time, the latest end time from column A for each person in Column B-F without the...
Top