Updating Inventory Value

rharri1972

Board Regular
Joined
Nov 12, 2021
Messages
132
Office Version
  1. 2019
Platform
  1. Windows
I have an inventory sheet with my "on hand" qty in cell G5. For this particular supply I currently have a value of 11 on hand (in Stock). I have a VB form in which I will "receive" in this same supply when it has been ordered and this process will add what I have received to what is already showing on hand. Example: On hand = 11, stock level is to be 15, I have ordered 4 and when it comes in, I will "receive" it "into the system" so that the new "on hand" level shows 15 in cell G5.

Is it possible to change the value in cell G5 from the VB form without having to reference two different cells to do the math? Can I, just from hitting an "update" button, have cell G5 know what to update to?

any help would be fantastic. I have looked and looked for software to do what I need for my new business but none is to be found to do what i need.

Thanks!!
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I've not tested this due to the missing items below, but it should work.

Assuming:
Your form is "UserForm1"
Worksheet Name is "Inventory"
Received quantity field on the form is "tbReceived"
The unique field on the form is "tbCatID" and matches with column A in the worksheet
In the workbook, the quantity on hand is in column G

Add this into the button press code, somewhere before the userform is dismissed:
VBA Code:
Dim Rng As Range
'Search in the A column in the Inventory worksheet
With Sheets("Inventory").Range("A:A")
    'You're looking for what's in the tbCatID textbox on the userform. Return Rng when you match. 
     Set Rng = .Find(What:=UserForm1.tbCatID.Value, _
                    After:=.Cells(.Cells.Count), _
                    LookIn:=xlValues, _
                    LookAt:=xlWhole, _
                    SearchOrder:=xlByRows, _
                    SearchDirection:=xlNext, _
                    MatchCase:=False)
    'if you get a match
    If Not Rng Is Nothing Then
        ' add the existing quantity to the received quantity and replace the existing value in column H of the row where you found the match
        .Cells(Rng.Row, 7) = .Cells(Rng.Row, 7) + UserForm1.Recived.Value
    Else
        'otherwise tell them you couldn't match the item number
        MsgBox "No Match found"
    End If
End With
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,496
Members
449,089
Latest member
Raviguru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top