+ Reply to Thread
Results 1 to 25 of 25

Next Available Number

  1. #1
    Registered User
    Join Date
    02-20-2012
    Location
    Elkton, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Red face Next Available Number

    I need to make a macro which will go to the PO numbers sheet and retrieve the next available PO Number and return it to the Purchase Order Sheet
    Then I would like a macro to take the pertinent info off the Purchase Order Sheet and paste in into the PO number sheet.. Is this able to be done?

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,737

    Re: Next Available Number

    Take a look at John McGimpsey's site here:

    http://www.mcgimpsey.com/excel/udfs/sequentialnums.html

    for two ways of doing it.

    Hope this helps.

    Pete

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

    Re: Next Available Number

    Please see the attachment for an example.

    It requires that the column headings and field names are identical.
    Attached Files Attached Files
    Martin

  4. #4
    Registered User
    Join Date
    02-20-2012
    Location
    Elkton, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Next Available Number

    Your macro runs beautifully but I can't seem to adapt it to my sheets
    Could you please make the changes necessary?

    On Purchase Order Sheet

    PO Number is in cell R5 Col E
    Date is in cell R6 Col E & F
    Vendor is in cell R11 Col B & C
    Total Cost is in cell R39 Col G
    Description is in cell R21 Col C & D

    On PO Number Sheet

    The Cells are just as your sheet had them..

    PO Number Column A
    PO Date Column B
    Vendor Column C
    Total PO Column D
    Job Number Column E
    Description Column F

    I figured out some of the changes but it crashes when it goes to put the info back

    Anne

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

    Re: Next Available Number

    Does E & F etc mean that you have merged cells?

  6. #6
    Registered User
    Join Date
    02-20-2012
    Location
    Elkton, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Next Available Number

    Yes because under them are columns for job # and unit price

    but we could just use the first cell for the date if it would run into the 2nd cell because one cell is not big enough for a full date format

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

    Re: Next Available Number

    Please have a look at the attached.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    02-20-2012
    Location
    Elkton, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Next Available Number

    Thank you very much... It works great... Am retired but just got a part time job in small fabricating office. It has been years since I worked with macros and I know what they can do but have forgotten how I did them... I hate to keep bothering you but I need to finish your macro with a copy PO to PO file and then clear template. I think I am ok with everything but how to get the macro to let you put in the correct PO number to the saved file.

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

    Re: Next Available Number

    Something like this might help.

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    02-20-2012
    Location
    Elkton, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Next Available Number

    I made changes in your code... just small ones but I have 2 problems... One is where to save it.... I tried to use the path to our network and it would not work... It does save it to my C: drive...

    The second problem is that I would like to save the "print area" not the whole sheet and also save the pretty colors and the Company Logo... I noticed that your code says delete drawing objects. Is this where you take off the color box and logo? I would like to leave it on the PO when it is saved... Also could we save it as a pdf? Can I send you my file so you can see the whole picture?

    This is what the code looks like now:

    Please Login or Register  to view this content.
    I am going on vacation in 1/2 hour.... If I do not hear from you by the time I leave, I will get back to you when I return.. Thank you for all your help.

    Anne
    Last edited by AnnieLaurie; 03-05-2012 at 12:30 PM. Reason: to comply with forum rules

  11. #11
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Next Available Number

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

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

    Re: Next Available Number

    The delete drawing objects was there to remove the button from the copied sheet - I was obviously unavare of other things that you had on there.

    It would be a best if you could post a copy of the actual sheet.

  13. #13
    Registered User
    Join Date
    02-24-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Next Available Number

    I was wondering the same thing actually thanks!
    www.vitaminlondon.com

  14. #14
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Next Available Number

    Your post does not comply with Rule 7 of our Forum RULES. Please do not ignore Moderators' or Administrators' requests - note that this includes requests by senior members as well, if you are unclear about their request or instruction then send a private message to them asking for help. Do not post a reply to a thread where a moderator has requested an action that has not been complied with e.g Title change or Code tags...etc

  15. #15
    Registered User
    Join Date
    02-20-2012
    Location
    Elkton, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Next Available Number

    How do I post a copy of the sheet in question?

    PS I think I corrected the post that was not in compliance.

    Anne

  16. #16
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Next Available Number

    Reply to Thread, click Go Advanced, and click the paperclip icon. Browse and upload your file, then close.

    Add some words to the post and post the reply.

  17. #17
    Registered User
    Join Date
    02-20-2012
    Location
    Elkton, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Next Available Number

    I edited my post #10 with what I think is the correction... If I am wrong, please let me know how to fix it... This is my first question in this forum and am unsure how to proceed.

  18. #18
    Registered User
    Join Date
    02-20-2012
    Location
    Elkton, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Next Available Number

    AF Purchase Order w Macro.xlsm

    Here is my spreadsheet... Hope it helps

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

    Re: Next Available Number

    Please see the attachment - hopefully its a bit closer to what you need.
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    02-20-2012
    Location
    Elkton, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Next Available Number

    Please Login or Register  to view this content.
    The bold part crashes and says "subscript out of range"

    Plus could you save it as a pdf?

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

    Re: Next Available Number

    Is your sheet still called Purchase Order - I expect the error that you are seeing when a non-existent sheet is mentioned in the code. I also note that there is no \ afer the colon in your constant declaration for the save path.

    wrt the PDF format, you will need something like

    Please Login or Register  to view this content.

  22. #22
    Registered User
    Join Date
    02-20-2012
    Location
    Elkton, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Next Available Number

    I was using the spreadsheet that you sent back and the macro did not run. I inserted the PDF code but did not know where to insert it or if I should take any code out... My experience with Macros is to use the record button. Also I cannot assign macros on the worksheet you sent back.. Do I need to enable something.. I could always do that before.
    Attached Files Attached Files

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

    Re: Next Available Number

    Please see the attached. I've attempted to get the graphics to transfer to the PDF as well.
    Attached Files Attached Files

  24. #24
    Registered User
    Join Date
    02-20-2012
    Location
    Elkton, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Next Available Number

    Thank you Thank you Thank you.... It seems to work great... I will finish checking it out tomorrow but I feel YOU have done a commendable job and I truly appreciate it... Thanks again

  25. #25
    Registered User
    Join Date
    02-20-2012
    Location
    Elkton, MD
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Next Available Number

    I tried to go to the first post and edit it to make it "solved" but I could not find a button for edit.
    Last edited by AnnieLaurie; 03-22-2012 at 11:23 AM.

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

    Re: Next Available Number

    Mark your post [SOLVED] by editing your original post title in advanced mode. It's not very obvious.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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