VBA Inventory

deadlyjack

New Member
Joined
Aug 21, 2021
Messages
23
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I'd like to generate a function for a specific cell, where the amount increases or decreases, depending on what the user types into a specific cell - connected to two different buttons.
Once clicked a button, the cellvalue needs to add/subtract from the original value, mounted in a separate spreadsheet (In this case, my manual inventory sheet). I need this function to work so that my employees can add and subtract depending on what they need.

I got a dropdown list with 10 different items, taken from my manual inventory sheet. The cell below (B8) has a VLOOKUP, =VLOOKUP(B6;Inventory!A2:B11;2;FALSE)

Kyl inventarie.xlsm
ABCDE
1
2
3
4
5SortAmount
6Loop Mango Tango20
7Amount in Storage
86040minus
980plus
10
11
12
Main
Cell Formulas
RangeFormula
B8B8=VLOOKUP(B6,Inventory!A2:B11,2,FALSE)
Cells with Data Validation
CellAllowCriteria
B6List=Inventory!$A$2:$A$11



VBA module for plus:
VBA Code:
Public Sub InventoryCountPlus()

i = ("B8")

Range("D9").Select
Range("D9") = Range("B8") + Range("D6")
Range("D5").Select
ActiveCell.Offset(1, 0).Select

i = i + ("B8")

End Sub

VBA module for minus:
VBA Code:
Public Sub InventoryCountMinus()

i = ("B8")

Range("D8").Select
Range("D8") = Range("B8") - Range("D6")
Range("D5").Select
ActiveCell.Offset(1, 0).Select

i = i + ("B8")

End Sub


How do proceed or what do I need to do in order to get a functional generator, which tells the user the current amount in cell B8?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Would've been easier to not have a secondparty, Inventory-sheet... But once a month I'll need to manually control the inventory & this sheet will automatically update the main-sheet.
 
Upvote 0
?
SOLVED: I've been running in circles...
I simply erased D9, change my VBD-code for plus, to D8 and now it works
 
Upvote 0

Forum statistics

Threads
1,224,885
Messages
6,181,577
Members
453,055
Latest member
cope7895

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