Inventory Stock Management

Joined
Apr 5, 2023
Messages
2
Office Version
  1. 2016
Platform
  1. Windows
Please I seriously need a VBA code for my inventory user form.
This code should avoid negative stock balance. It should prompt and avoid me from making sales more than available in stock.
Below will help your understanding to my request.
(A)Product NameOpening StockPurchaseSalesClosing Stock
Apple
85​
0​
100​
-15​
Watermelon
26​
0​
15​
11​
Sugarcane
13​
0​
28​
-15​
Banana
50​
0​
5​
45​
Pawpaw
77​
0​
80​
-3​
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
why use VBA? Data Validation will give input error messages:
mr excel questions 22.xlsm
ABCDEF
1(A)Product NameOpening StockPurchaseSalesClosing Stock
2Apple850100-15
3Watermelon2601511
4Sugarcane13028-15
5Banana500545
6Pawpaw77080-3
Isaac Fiifi Fergusson
Cells with Data Validation
CellAllowCriteria
E2:E6Whole number<=C2
 
Upvote 0
why use VBA? Data Validation will give input error messages:
mr excel questions 22.xlsm
ABCDEF
1(A)Product NameOpening StockPurchaseSalesClosing Stock
2Apple850100-15
3Watermelon2601511
4Sugarcane13028-15
5Banana500545
6Pawpaw77080-3
Isaac Fiifi Fergusson
Cells with Data Validation
CellAllowCriteria
E2:E6Whole number<=C2
NOTE: The above is the cells before the data validation was put on, so it still has the values which cause negative differences. If you use this validation it will not allow you to type 100 in cell E2.
 
Upvote 0
you are welcome It does have it limitations however.
Someone can paste values into the cell versus typing them and the data validation will not kick in.
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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