Subtract cell value based on textbox

  • Hello everyone,


    I have a userform which has a listbox with 3 columns (Type, Size and Inventory) and a few textboxes. The listbox gets its values from a main table.


    1. I want to select multiple items from the listbox and add it to a new worksheet called "Data". Also the Textbox values need to added there.
    2. Every time I add something it has to place values beneath the last used row.
    3. Every time I add an amount to "Data" it has to subtract that textbox value from the main table's Inventory on worksheet "Inventory".
    4. When the inventory of an item is 0 it needs to show a message.


    Is this possible? It seems quite a large project.
    I have an example sheet in attachment.forum.ozgrid.com/index.php?attachment/73689/


    I am still learning VBA :)


    Thank you!

  • Re: Subtract cell value based on textbox


    Hello! Create a command button for your user form (to run the code when clicked) and then paste in this code to the userform module:



    I hope this helps!


    -Max

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!