+ Reply to Thread
Results 1 to 8 of 8

How to Update Stock quantity if I sold items?

  1. #1
    Registered User
    Join Date
    12-07-2007
    Posts
    9

    How to Update Stock quantity if I sold items?

    Hi all, please I want to update my Stock Quantity if I sold Item X or Y or Z and added the quantity of the item sold.

    I attached my excel sheet, how could be a possible easy way to automatically update the stock quantity if i changed the sold items quantity?

    I have A2:A6 as a Drop down List . Items are "Batteries" <== name list


    P.S The Quantity of each battery name is under Stock beside the name of each battery.

    Thank you!
    Attached Files Attached Files
    Last edited by saad3000; 12-07-2007 at 07:37 PM.

  2. #2
    Registered User
    Join Date
    12-07-2007
    Posts
    9
    please anyone knows how to do this?

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Saad3000,

    The attached workbook contains the following macros. The main macro adjusts the stock level based on the current stock less what has been sold. The other macro is in the Worksheet_Change() event which checks the entry and then calls the main macro.

    Stock Level (main macro)
    Please Login or Register  to view this content.
    Worksheet_Change() Event Macro
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    12-07-2007
    Posts
    9
    Thanks Leith , I did not thought that it need macros to do this Thats hard! But thanks! appreciate it!

    I tried to copy and paste it to my original sheet and i changed the name Set Rng = Worksheets("Sheet1").Range("Batteries") to Sheet2 where my work is.
    and I changed also If Not Intersect(Target, Range("B2:B6")) to "D2:D25" in Worksheet_Change() but did not work any ideas?
    Last edited by saad3000; 12-09-2007 at 08:20 PM.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Saad3000,

    It is possible to do this with formulae but you would need to change your format. The macros are faster since the only run when needed. Every formula in the workbook will be run anytime a change is made to cell that contains a formula. While the formula is often easier, it isn't always the best approach. If you have questions about the code or what it does, just ask.

    Sincerely,
    Leith Ross

  6. #6
    Registered User
    Join Date
    12-07-2007
    Posts
    9
    I tried to copy and paste it to my original sheet and i changed the name ("Sheet1") to Sheet2 where my work is.
    and I changed also Target, Range("B2:B6")) to "D2:D25" in Worksheet_Change() but did not work any ideas?

    Function StockLevel(Item_Name As String, Qty_Sold As Double) are these the names of the cells ?


    **And if it would be done with a simple formula i will take my chances
    Last edited by saad3000; 12-09-2007 at 08:30 PM.

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Saad3000,

    (This is in reference to a private message)You reversed your macros when you installed them. Your changes to the new addresses were correct. The updates occur automatically whenever you change the sold quantity. No formulas needed. If you have any other questions, let me know.

    Sincerely,
    Leith Ross

  8. #8
    Registered User
    Join Date
    12-07-2007
    Posts
    9
    Thank you for your help and time, I appreciate it! Thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1