Hi everyone,
I am having a issue with a VBA im trying out for a inventory list.
So, i need to enter/scan the article ID into the aID.value and vlookup will extract the require information.
And if i have some items receive today, i will need to enter the qty in the qtyr.value.
and after i click the cmdInbound, the data is save in the worksheet, but will gives me the above mention error.
please help.
Private Sub aID_Afterupdate()
If WorksheetFunction.CountIf(Sheets("Item List").Range("A:A"), aID.Value) = 0 Then
MsgBox "This is an incorrect Article ID"
Me.aID.Value = ""
Else
With Me
.Desc.Value = Application.VLookup(aID.Value, Sheets("Item List").Range("A:F"), 3, False) <----this is where the debug shows the error
.Qtyl.Value = Application.VLookup(aID.Value, Sheets("Item List").Range("A:F"), 4, False)
.manu.Value = Application.VLookup(aID.Value, Sheets("Item List").Range("A:F"), 6, False)
End With
End If
Me.time.Value = Now
time = Format(time.Value, "H:MM AM/PM")
Me.date1.Value = Now
date1 = Format(date1.Value, "dd-mm-yy")
End Sub
Private Sub cmdInbound_Click()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("In-Bound")
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
.Cells(lRow, 1).Value = Me.aID.Value
.Cells(lRow, 2).Value = Me.Desc.Value
.Cells(lRow, 3).Value = Me.qtyr.Value
.Cells(lRow, 4).Value = Me.date1.Value
End With
MsgBox "Item has been successfully added"
Me.aID.Value = ""
Me.Desc.Value = ""
Me.Qtyl.Value = ""
Me.qtyr.Value = ""
Me.Qtyu.Value = ""
Me.manu.Value = ""
Me.mID.Value = ""
Me.restock.Value = ""
Me.time.Value = ""
Me.date1.Value = ""
Me.comm.Value = ""
Me.aID.SetFocus
End Sub
Private Sub UserForm_Click()
End Sub
I am having a issue with a VBA im trying out for a inventory list.
So, i need to enter/scan the article ID into the aID.value and vlookup will extract the require information.
And if i have some items receive today, i will need to enter the qty in the qtyr.value.
and after i click the cmdInbound, the data is save in the worksheet, but will gives me the above mention error.
please help.
Private Sub aID_Afterupdate()
If WorksheetFunction.CountIf(Sheets("Item List").Range("A:A"), aID.Value) = 0 Then
MsgBox "This is an incorrect Article ID"
Me.aID.Value = ""
Else
With Me
.Desc.Value = Application.VLookup(aID.Value, Sheets("Item List").Range("A:F"), 3, False) <----this is where the debug shows the error
.Qtyl.Value = Application.VLookup(aID.Value, Sheets("Item List").Range("A:F"), 4, False)
.manu.Value = Application.VLookup(aID.Value, Sheets("Item List").Range("A:F"), 6, False)
End With
End If
Me.time.Value = Now
time = Format(time.Value, "H:MM AM/PM")
Me.date1.Value = Now
date1 = Format(date1.Value, "dd-mm-yy")
End Sub
Private Sub cmdInbound_Click()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("In-Bound")
lRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
With ws
.Cells(lRow, 1).Value = Me.aID.Value
.Cells(lRow, 2).Value = Me.Desc.Value
.Cells(lRow, 3).Value = Me.qtyr.Value
.Cells(lRow, 4).Value = Me.date1.Value
End With
MsgBox "Item has been successfully added"
Me.aID.Value = ""
Me.Desc.Value = ""
Me.Qtyl.Value = ""
Me.qtyr.Value = ""
Me.Qtyu.Value = ""
Me.manu.Value = ""
Me.mID.Value = ""
Me.restock.Value = ""
Me.time.Value = ""
Me.date1.Value = ""
Me.comm.Value = ""
Me.aID.SetFocus
End Sub
Private Sub UserForm_Click()
End Sub
Last edited: