+ Reply to Thread
Results 1 to 20 of 20

Autogenerate purchase order number and input to Userform.

  1. #1
    Registered User
    Join Date
    04-05-2013
    Location
    Perth, Australia
    MS-Off Ver
    2013
    Posts
    30

    Autogenerate purchase order number and input to Userform.

    I have a worksheet for creating and storing purchase orders. I have several different sheets and the main 'front page' sheet with command buttons. The command buttons are linked with userforms that are working perfectly, and inputting data into the appropriate sheet where and when I want.
    However, on the worksheet that stores all the purchase orders, it is setup on some sort of Excel table. So if I'm manually putting in data, I just tab over the edge of the table and it automatically starts a new row and I have arranged for it to auto generate the next number.
    What I want to do it:
    When I click on the command button to create new purchase order, I would like the userform to go to the sheet where the purchase orders are recorded and find the next purchase order number. Therefore, going to the sheet ("Purchase Orders") and finding the last line of data +1. Then finding the auto-generated next invoice number from column A.
    I'm not sure if it's possible, as the next invoice number is not actually generated yet, so the code may have to include allowing the table on sheet "Purchase Orders" to generate the number, then place it at the top of the userform.
    I don't know if I'm making sense - hopefully. I've been working on this for hours! TIA.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Autogenerate purchase order number and input to Userform.

    Can you attach a sample of what you have and what you want...include any code and UserForms.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Registered User
    Join Date
    04-05-2013
    Location
    Perth, Australia
    MS-Off Ver
    2013
    Posts
    30

    Re: Autogenerate purchase order number and input to Userform.

    Hi gmr4evr1, Thank you so much for posting. I'll do my best, as I'm not sure exactly how to show you all the info, but I'll give it a go.

    So the 'front page' with command buttons' code looks like this:
    Please Login or Register  to view this content.
    OK. The code for the userform is:

    Please Login or Register  to view this content.
    Purchase Orders Table View.PNG

    I hope that worked. We'll see.
    Last edited by scrawl.to.me; 05-29-2016 at 03:25 PM.

  4. #4
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Autogenerate purchase order number and input to Userform.

    To make the code easier to read, please click Edit Post, highlight the code then click the # sign.
    A lot of members, including myself, are unable to see images on here.
    Without seeing how the workbook and userform(s) are setup it would be very difficult to try to figure out a way to assist you.

  5. #5
    Registered User
    Join Date
    04-05-2013
    Location
    Perth, Australia
    MS-Off Ver
    2013
    Posts
    30

    Re: Autogenerate purchase order number and input to Userform.

    So what I want is on the table (as shown in image) to autogenerate the next invoice number. So in this second image, I have 'tabbed' all the way past Row I, which then starts a new line and automatically put the next purchase order number there (POER1004).

    table.PNG

    So I want to write into the userform or into the command button (AddNewPO) code so that the next PO number will automatically go into the top text box of the user form (pic attached).

    userform.PNG

    Hopefully, I'm making some sense..

  6. #6
    Registered User
    Join Date
    04-05-2013
    Location
    Perth, Australia
    MS-Off Ver
    2013
    Posts
    30

    Re: Autogenerate purchase order number and input to Userform.

    Oops, only just saw this. I will edit the post now.

  7. #7
    Registered User
    Join Date
    04-05-2013
    Location
    Perth, Australia
    MS-Off Ver
    2013
    Posts
    30

    Re: Autogenerate purchase order number and input to Userform.

    Is that code helpful? Do I need to attach something else? As you said photos are no good..

  8. #8
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Autogenerate purchase order number and input to Userform.

    Much better with the code. One of the forum rules is to post code in that manner.
    Yes, if you could attach a file with the code and userform(s) in it that would help a lot. If we have a sample to work with, it makes it easier for us to not only see what you are working with, but allows us step through the code to see what it is doing, which will also help us to meet your requirements better.

  9. #9
    Registered User
    Join Date
    04-05-2013
    Location
    Perth, Australia
    MS-Off Ver
    2013
    Posts
    30

    Re: Autogenerate purchase order number and input to Userform.

    Sorry to be a pain, how do I attach the sample?

  10. #10
    Registered User
    Join Date
    04-05-2013
    Location
    Perth, Australia
    MS-Off Ver
    2013
    Posts
    30

    Re: Autogenerate purchase order number and input to Userform.

    I think I have attached the excel sheet here.
    Attached Files Attached Files

  11. #11
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Autogenerate purchase order number and input to Userform.

    I've been trying a few things but so far non have worked. I was thinking using LastRow would do the trick but it's not. Here is what I was trying on the add new PO button
    Please Login or Register  to view this content.
    But, all it does is put a 1 in the txtPONumber textbox. It's not pulling the value or text from the last row in column A of the Purchase Orders sheet.

  12. #12
    Registered User
    Join Date
    04-05-2013
    Location
    Perth, Australia
    MS-Off Ver
    2013
    Posts
    30

    Re: Autogenerate purchase order number and input to Userform.

    Hi gmr4evr1. Thank you so much for trying. It is a doozy, for sure. I was really hopeful it could be done. I'll keep trying and let you know if I come up with anything. Thank you.

  13. #13
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Autogenerate purchase order number and input to Userform.

    Please Login or Register  to view this content.

  14. #14
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Autogenerate purchase order number and input to Userform.

    bakerman2 to the rescue again!!!
    I tried 3 different ways of doing this and the code you provided was similar to the 2nd one I tried, but I could get the Right(.Range("A" & .Rows.Count).End(xlUp).Value, 4) + 1 part of it correct. After seeing your code, I now know why. I was placing the 4 in the wrong place. I had it after the "A" instead of Value.

    @scrawl.to.me
    bakerman2's code works perfectly!

  15. #15
    Registered User
    Join Date
    04-05-2013
    Location
    Perth, Australia
    MS-Off Ver
    2013
    Posts
    30

    Re: Autogenerate purchase order number and input to Userform.

    Oh, you are the bomb, bakerman2! Thank you both bakerman2 and gmr4evr1!
    That is wonderful. I have a number of other functions I want to put in this workbook, but am deciding what next - I'm sure you'll hear from me again! =)

  16. #16
    Registered User
    Join Date
    04-05-2013
    Location
    Perth, Australia
    MS-Off Ver
    2013
    Posts
    30

    Re: Autogenerate purchase order number and input to Userform.

    Actually, I have another related query, as I thought this would be easy after solving the last problem, but it's not proving as easy as expected..
    How do I code it, so that when 'SaveEntry' is clicked it automatically changes Cell E3 on Worksheet 'Front Page' to the number that has just been created (by bakerman2's code!) in the "POER Number" text box in the NewPO userform?

    Therefore, if I open the form and it gives me a new POER number of 86 (the "POER Number" text box, can I automatically have it change the selection of E3 on worksheet "Front Page" to POER86? Note that "Front Page" cell "E3" input is based on a list, so I want to choose the last number in the list.

    Hope I'm making sense.
    Last edited by scrawl.to.me; 05-31-2016 at 12:51 PM. Reason: wasn't clear meaning

  17. #17
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Autogenerate purchase order number and input to Userform.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  18. #18
    Registered User
    Join Date
    04-05-2013
    Location
    Perth, Australia
    MS-Off Ver
    2013
    Posts
    30

    Re: Autogenerate purchase order number and input to Userform.

    Wow! Lifesaver. You have helped immensely. Helped relieve much stress and anxiety! Thank you once again!

  19. #19
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Autogenerate purchase order number and input to Userform.

    Helped relieve much stress and anxiety
    What a visit to a XL-forum can do.
    You're more then welcome.

  20. #20
    Registered User
    Join Date
    04-05-2013
    Location
    Perth, Australia
    MS-Off Ver
    2013
    Posts
    30

    Re: Autogenerate purchase order number and input to Userform.

    Thank you. I'm sure you'll be hearing from me again. I have BIG plans for this worksheet!

+ 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] Populate my Purchase order from a list of Purchase Order numbers and their details
    By Carolbell44 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-11-2015, 07:14 AM
  2. [SOLVED] Add an Autonumber to a column, for use as a sequential Purchase Order Number
    By oracle741 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-24-2013, 04:44 PM
  3. [SOLVED] Group and Subtotaling by Purchase order number
    By mojogoon in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-07-2013, 11:41 AM
  4. Macro Reqd to update Purchase order log, everytime a new purchase order is made
    By manthankanabar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-23-2012, 01:47 AM
  5. purchase order list & order number generator
    By podaf in forum Excel General
    Replies: 2
    Last Post: 06-28-2009, 06:02 PM
  6. [SOLVED] Increment Purchase Order Number
    By Curious in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2006, 09:40 AM
  7. [SOLVED] purchase order counter in excel purchase order template
    By Brandy@baoco in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-23-2005, 03:06 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