Response - Updating inventory

Is this what you are looking for ?

AttachmentSize
Inventory.xlsm47.65 KB

Trace the invalid transcation

yeahh..almost something like that.

unless in term logic inventory operation.

If the quantity out is more than available quantity, the transaction should be non valid and display error message.
How can we can take out something which is not available at the first place.

How can i fix this? Hope u can help me to modify the code a little bit cause to be honest i know nothing about VBA.

Thanks anyway.

Modify the code to the

Modify the code to the following

Private Sub CommandButton1_Click()
Dim RowNum As Integer
If Range("E8") = "" And Range("E10") = "" Then Exit Sub
If MsgBox("Confirm transaction.", vbYesNo, "Confirmation") = vbNo Then Exit Sub

RowNum = WorksheetFunction.Match(Range("E4").Value, Sheet3.Range("D4:D103"), 0) + 3
Select Case Range("E8").Value
Case "IN"
Sheet3.Range("H" & RowNum).Value = Sheet3.Range("H" & RowNum).Value + Sheet2.Range("E10").Value

Case "OUT"
If Sheet3.Range("H" & RowNum).Value - Sheet2.Range("E10").Value > 0 Then
Sheet3.Range("H" & RowNum).Value = Sheet3.Range("H" & RowNum).Value - Sheet2.Range("E10").Value
Else
MsgBox "Insufficient inventory to support your request. There are only " & Sheet3.Range("H" & RowNum).Value & " items available"
End If
End Select
Sheet2.Calculate
End Sub