Response - Updating inventory
Is this what you are looking for ?
Attachment | Size |
---|---|
Inventory.xlsm | 47.65 KB |
ExcelExperts.comExcel Consultancy, VBA Consultancy, Training and Tips Call:+442081234832 |
|
Excel / VBA ConsultancyFree Training VideosFree SpreadsheetsExcel / VBA JobsNavigationWho's onlineThere are currently 0 users and 691 guests online.
New Excel Experts
Current Excel / VBA Jobs |
Response - Updating inventoryIs this what you are looking for ?
|
Highest Ranked Users
Recent Blogs
ForumsRecent comments
User login |
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