+ Reply to Thread
Results 1 to 17 of 17

Help with a Stock Control Database

  1. #1
    Registered User
    Join Date
    10-29-2011
    Location
    Hull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Help with a Stock Control Database

    Hi
    I am wanting to copy the current stock item total from one sheet to another but I am stuck. I only know how to copy the info from a certain cell which does help me. I have attached the file any help would be gratefully appreciated
    Attached Files Attached Files

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Help with a Stock Control Database

    You can do this with a user defined function (UDF).

    Open the VBA editor (Alt F11) , add a new module by INSERT - MODULE

    Paste in the following code.

    Please Login or Register  to view this content.
    return to the worksheet (Alt F11) and in D2 on the first sheet, type in =GetCurrentStockAmount(A2).

    This can then be copied down to the other cells below as for any other function.
    Martin

  3. #3
    Registered User
    Join Date
    10-29-2011
    Location
    Hull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Help with a Stock Control Database

    Thats brilliant thanks

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Help with a Stock Control Database

    A non-macro solution is to put this formula into D2 and copy down:

    =INDEX(INDEX('Stock Item Record'!G:G,MATCH(A2,'Stock Item Record'!C:C,0)+7):'Stock Item Record'!G148,MATCH("",INDEX('Stock Item Record'!G:G,MATCH(A2,'Stock Item Record'!C:C,0)+8):INDEX('Stock Item Record'!G:G,MATCH(A2,'Stock Item Record'!C:C,0)+20),0),0)
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Registered User
    Join Date
    10-29-2011
    Location
    Hull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Help with a Stock Control Database

    Hi Martin
    Is there any way the macro can be updated to take info from multiple sheets, Ive tried editing the macro you did for me but to be honest I don't really know what im doing
    Cheers
    Attached Files Attached Files

  6. #6
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Help with a Stock Control Database

    I hope that this does the trick.

    Please Login or Register  to view this content.
    I've used the leftmost two characters from the SKU code to target the correct sheet.

  7. #7
    Registered User
    Join Date
    10-29-2011
    Location
    Hull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Help with a Stock Control Database

    Hi Martin
    Thanks for that, but I've totally messed it up I think if you get chance will you hae a look at it for me
    Cheers
    Attached Files Attached Files

  8. #8
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Help with a Stock Control Database

    The problem is that you have multiple modules, all containing a function with the same name.

    If you remove all modules except for Module 5, you should be OK.

  9. #9
    Registered User
    Join Date
    10-29-2011
    Location
    Hull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Help with a Stock Control Database

    Hi Martin
    Ar yes thats done the trick works fine now. Thanks again
    I know I will need to add some more sheets, will the Macro stil work?
    Cheers
    Last edited by markransom; 11-05-2011 at 03:32 PM.

  10. #10
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Help with a Stock Control Database

    Provided that you stick to the current convention of naming the sheet with the first two letters of the SKU code, you should be OK. Please post back if this is not the case.

  11. #11
    Registered User
    Join Date
    10-29-2011
    Location
    Hull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Help with a Stock Control Database

    Hi Martin
    I have added an extra colum to my spreadsheet and I've managed to stop the macro you did for me from working
    If you get chance will you have a look at it for me
    Cheers
    Attached Files Attached Files

  12. #12
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Help with a Stock Control Database

    Try this.

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    10-29-2011
    Location
    Hull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Help with a Stock Control Database

    Cheers m8, works a treat much appriciated

  14. #14
    Registered User
    Join Date
    10-29-2011
    Location
    Hull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Help with a Stock Control Database

    Deleted post problem sorted
    Last edited by markransom; 01-14-2012 at 10:46 AM.

  15. #15
    Registered User
    Join Date
    10-29-2011
    Location
    Hull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Help with a Stock Control Database

    Hi Martin

    I've been using this database all year with no problems it works perfectly, however I have just realized that items where I have inserted extra rows, the current stock value on stock list page is incorrect. I have looked at the macro and it looks like it counts down 34 lines from the stock code so when I add extra rows to a particular code the current stock value freezes at 34 rows down. Is there anyway around this?

    Thanks in advance
    Mark

  16. #16
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Help with a Stock Control Database

    Hi

    Try this which should deal with variation in the length of the record set.

    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    10-29-2011
    Location
    Hull
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Help with a Stock Control Database

    Thanks Martin you are a star

+ 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