Hi guys.
I need some help here. I want a macro that can update the inventory by using the user form. I need a macro to be assigned on "check availability" command button.
Every time the user insert the item code in textbox1, the macro will identify the value in textbox1 which match the code in database column C.Then, it will display the respective quantity in column I into textbox2 (user form).
However, if the textbox1 (user form) = "" or value in textbox1(userform) doesnt not exist in database, the macro need to display "Not available" message.
Here are the the code that i try to modify, but it doesnt fully work on certain condition
Private Sub CommandButton1_Click()
x = 9
Dim qty As Integer
qty = 0
Do While Cells(x, 3) <> ""
If TextBox1.Text = Cells(x, 3) Then
TextBox2.Value = Cells(x, 9)
qty = qty + TextBox2.Value
End If
x = x + 1
Loop
TextBox2.Value = qty
MsgBox "WRONG"
End Sub
I hope you can help me on this. Thanks in advance. Really appreciate your help.
Bookmarks