+ Reply to Thread
Results 1 to 18 of 18

A Way to edit an inventory list through a macro in a different workbook?

  1. #1
    Registered User
    Join Date
    08-01-2018
    Location
    Ann Arbor, MI
    MS-Off Ver
    2016
    Posts
    96

    A Way to edit an inventory list through a macro in a different workbook?

    Hello! Right now I have an inventory list that has a macro in it where you can manually add parts onto a reserve so that other people will not use them.
    Basically you just type in the quantity and the part number and it will look up the part number within the inventory and add whatever quantity was specified to the 'On Reserve' cell in that row.

    What I am trying to do is change that process so it happens automatically. I have a work order template with a button "Book PO". When that button is clicked, I would like the macro to find the list of part numbers and their quantities on the work order and then open up the inventory list and find each of the part numbers and then change their On Reserve amount.

    This is what I have at the moment

    Please Login or Register  to view this content.
    When I run that it says "type mismatch" referring to the addition symbol in
    Please Login or Register  to view this content.
    Any help would be appreciated

    This post is cross referenced at: https://www.mrexcel.com/forum/excel-...-workbook.html
    Last edited by whahmira; 09-06-2018 at 02:06 PM. Reason: Cross Reference

  2. #2
    Registered User
    Join Date
    08-01-2018
    Location
    Ann Arbor, MI
    MS-Off Ver
    2016
    Posts
    96

    Re: A Way to edit an inventory list through a macro in a different workbook?

    I tried adding an If statement to see if it would fix the mismatch error and it did not, but here is the second attempt:

    Please Login or Register  to view this content.
    Last edited by whahmira; 09-06-2018 at 09:05 AM.

  3. #3
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: A Way to edit an inventory list through a macro in a different workbook?

    Please upload a desensitized sample of inventory book(containing maximum 20 records) and the fron end book. Put some desired results that will be fetched from the Inventory book.
    Teach me Excel VBA

  4. #4
    Registered User
    Join Date
    08-01-2018
    Location
    Ann Arbor, MI
    MS-Off Ver
    2016
    Posts
    96

    Re: A Way to edit an inventory list through a macro in a different workbook?

    Ok - Test Workbook is the Work Order Form, and Workbook B is the Inventory List.

    I have highlighted in yellow where the part numbers/quantities are in the order form and the location that they are paired with in the inventory list.
    I left values in the inventory list where the new values will appear if the macro works because when the macro runs it is supposed to add to the old On Reserve values.

    Also, I highlighted the Sales2018 in blue. This has the same concept as the On Reserve: the new values from the order form will be added to the values already in there.

    The macro can be seen through the button "book"
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor ImranBhatti's Avatar
    Join Date
    03-27-2014
    Location
    Rawalpindi,Pakistan
    MS-Off Ver
    Office 365
    Posts
    1,784

    Re: A Way to edit an inventory list through a macro in a different workbook?

    Still not clear how did you map the both
    Attached Images Attached Images

  6. #6
    Registered User
    Join Date
    08-01-2018
    Location
    Ann Arbor, MI
    MS-Off Ver
    2016
    Posts
    96

    Re: A Way to edit an inventory list through a macro in a different workbook?

    What I am showing with the colors is that the Part Number in the Work Order can be found somewhere in the list in the Database. I highlighted with color to show the three that the macro should find in the list. It should then take the quantity in the "Qty." column of the Work Order and add that number to the quantity of what is "On Reserve" in the Database. In addition to that the quantity in the "Qty." column should be added to the "2018 Sales" column in the Database in the row of its Part Number.

    So since the part number 001234567891 has 2 parts already 'On Reserve', the 2 in the "On Reserve" column should be replaced with 22 (because the quantity in the order form is 20). The "2018 Sales" column should then read 45 because of the 20 new parts and the 25 parts already sold.
    Last edited by whahmira; 09-06-2018 at 11:37 AM.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,945

    Re: A Way to edit an inventory list through a macro in a different workbook?

    Rule 08: Cross-posting Without Telling Us

    Your post does not comply with Rule 8 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question. If you have fewer than 10 posts here, you will not be able to post a link, but you must still tell us where else you have asked the question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    If you have less than 10 posts, do not try to copy and paste the link. Instead, type the link out in your thread.

    No further help to be offered, please, until the OP has complied with this request.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  8. #8
    Registered User
    Join Date
    08-01-2018
    Location
    Ann Arbor, MI
    MS-Off Ver
    2016
    Posts
    96

    Re: A Way to edit an inventory list through a macro in a different workbook?

    Alright, this is now where the code is at:

    Please Login or Register  to view this content.
    It is still not transferring the new quantities to the inventory. I have cleaned up the workbooks as well.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    08-01-2018
    Location
    Ann Arbor, MI
    MS-Off Ver
    2016
    Posts
    96

    Re: A Way to edit an inventory list through a macro in a different workbook?

    Quote Originally Posted by AliGW View Post
    Rule 08: Cross-posting Without Telling Us

    Your post does not comply with Rule 8 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question. If you have fewer than 10 posts here, you will not be able to post a link, but you must still tell us where else you have asked the question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    If you have less than 10 posts, do not try to copy and paste the link. Instead, type the link out in your thread.

    No further help to be offered, please, until the OP has complied with this request.
    I have completed the request by editing the first post in this thread with the cross reference. Thanks

  10. #10
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: A Way to edit an inventory list through a macro in a different workbook?

    find each of the part numbers and then change their On Reserve amount.
    It seems it is not only the amount you change but also the "Delivered" added to "2018 Sales"
    Is it ??
    - Battle without fear gives no glory - Just try

  11. #11
    Registered User
    Join Date
    08-01-2018
    Location
    Ann Arbor, MI
    MS-Off Ver
    2016
    Posts
    96

    Re: A Way to edit an inventory list through a macro in a different workbook?

    The Delivered column should not be added anywhere. The D column in test_Workbook "Qty" should be added to both the "On Reserve" and "2018 Sales" current values in WorkbookB

    Right now the macro is not cycling through the entire inventory list, but instead stopping at the top. That is why I created nRow, but it is not working

  12. #12
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: A Way to edit an inventory list through a macro in a different workbook?

    See next code and comment
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    08-01-2018
    Location
    Ann Arbor, MI
    MS-Off Ver
    2016
    Posts
    96

    Re: A Way to edit an inventory list through a macro in a different workbook?

    That brought over the new quantities to the On Reserve, but it did not do the same with the 2018 Sales
    I added the line below to fix that.
    Please Login or Register  to view this content.

    Thanks for your help!

  14. #14
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: A Way to edit an inventory list through a macro in a different workbook?

    Excellent, you are now the owner of the code ...!
    Is the story done ??? If yes close the thread .
    Last edited by PCI; 09-25-2018 at 11:39 AM.

  15. #15
    Registered User
    Join Date
    08-01-2018
    Location
    Ann Arbor, MI
    MS-Off Ver
    2016
    Posts
    96

    Re: A Way to edit an inventory list through a macro in a different workbook?

    Thanks again! All set

  16. #16
    Registered User
    Join Date
    08-01-2018
    Location
    Ann Arbor, MI
    MS-Off Ver
    2016
    Posts
    96

    Re: A Way to edit an inventory list through a macro in a different workbook?

    Hello again.
    Today I tried to run this code and it did not work with the debug "Object Required".
    The code is as follows:

    Please Login or Register  to view this content.
    I know that the part number trying to be edited in the inventory does not exist in there, so the message box should be appearing for the user, not the debug.
    Not sure if this is related to the issue or not. Any suggestions?

  17. #17
    Registered User
    Join Date
    08-01-2018
    Location
    Ann Arbor, MI
    MS-Off Ver
    2016
    Posts
    96

    Re: A Way to edit an inventory list through a macro in a different workbook?

    I have tried rewriting it like this and same error this time at the highlighted line

    Please Login or Register  to view this content.

  18. #18
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: A Way to edit an inventory list through a macro in a different workbook?

    First loop (For) is ending before the second one

    Please Login or Register  to view this content.
    you should have

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Cannot edit macro in hidden workbook
    By debspecs in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-14-2022, 09:17 AM
  2. [SOLVED] index match inventory list generated from another inventory list
    By dmike23 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-01-2017, 11:08 AM
  3. Replies: 5
    Last Post: 04-30-2014, 05:46 PM
  4. Replies: 0
    Last Post: 04-29-2014, 01:01 PM
  5. Create, edit and save workbook from list of data
    By mwhitedesigns in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-02-2013, 01:02 PM
  6. Create, edit and save workbook from list of data
    By mwhitedesigns in forum Excel General
    Replies: 1
    Last Post: 12-21-2012, 12:46 PM
  7. Replies: 0
    Last Post: 10-04-2005, 08:05 PM

Tags for this Thread

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