+ Reply to Thread
Results 1 to 13 of 13

Auto Running Number in Excel Worksheet

  1. #1
    Registered User
    Join Date
    10-17-2013
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    12

    Smile Auto Running Number in Excel Worksheet

    Hi everyone.
    Pls review on the attached PO Template, which I use it to issue Purchase Order and keep track on monthly purchases.
    This template allow me generate a fresh PO with feature of auto "Naming" which is also the refernce number of the PO.
    However, its only allow me to generate at maximum of 1000 POs in same worksheet with limited reference number to 3 digits, i.e. from POFM 001 ~ 1000. If i further generate the PO in this workbook for more that 1000, there incremental sequence number will just not working..

    What I wish for improve for this template are as follows:-

    1. Is there a way for me to start my running number which is more that 3 digits?
    2. As I am creating a new workbook monthly (which is to avoid a heavy file size over time), how I can continue the running number from previous month in another new workbook for coming month?
    3. I wish to have same PO refernce number (which is the same as worksheet name) in the body of PO template say in default cell "H4" when a new PO is created, how can I do this with VBA?

    Hope someone could help...

    Regards, CJ Yap
    Attached Files Attached Files
    Last edited by Yap Chin Joo; 10-28-2013 at 01:22 PM. Reason: Spelling

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Auto Running Number in Excel Worksheet

    in the addsheet() macro in module 1 change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    and in this bit
    Please Login or Register  to view this content.
    insert this
    Please Login or Register  to view this content.
    so it becomes
    Please Login or Register  to view this content.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Registered User
    Join Date
    10-17-2013
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Auto Running Number in Excel Worksheet

    Hi Martin.
    Thanks the your help, it work!!
    Now I am able to have 4 or more digits for the PO reference no and it also auto insert into the body of PO as well.

    However, as I do a test run with starting number other than zero, say with "87500". The next incremental number is just dont create according to this sequence, instead with "875502"?? I have attached my working template in the attachement for your reference. Pls assist me further.

    Thanks again..
    CJ yap
    Attached Files Attached Files
    Last edited by Yap Chin Joo; 10-28-2013 at 01:23 PM. Reason: Spelling

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Auto Running Number in Excel Worksheet

    you are confused by the function of the number format in this line.

    Please Login or Register  to view this content.
    if should be
    Please Login or Register  to view this content.
    The zeros in quotes tell the Format function how to represent the value of intLastNum + 1. The zeros are digit holders. The Format help says

    Digit placeholder. Display a digit or a zero. If the expression has a digit in the position where the 0 appears in the format string, display it; otherwise, display a zero in that position.
    If the number has fewer digits than there are zeros (on either side of the decimal) in the format expression, display leading or trailing zeros. If the number has more digits to the right of the decimal separator than there are zeros to the right of the decimal separator in the format expression, round the number to as many decimal places as there are zeros. If the number has more digits to the left of the decimal separator than there are zeros to the left of the decimal separator in the format expression, display the extra digits without modification.
    You may have to revise the code you have for getting the most recent value as that only checks last 3 digits.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    10-17-2013
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Auto Running Number in Excel Worksheet

    Hi Andy. Thanks for your guide.
    As I need to start with a most recent number. Say with "87501". How what is the change in the coding?
    Pls help..

    Rdgs, CJ
    Last edited by Yap Chin Joo; 10-28-2013 at 01:26 PM.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Auto Running Number in Excel Worksheet

    How should the program determine start value? Is it read from some cell, or from the sheet tab number or something else?

  7. #7
    Registered User
    Join Date
    10-17-2013
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Auto Running Number in Excel Worksheet

    Hi Andy. Thanks again.
    I presume the starting number is from below code. Is that a way let say if i start the reference no from PO Template?
    If that is the case, how i can work the out?

    Please Login or Register  to view this content.

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Auto Running Number in Excel Worksheet

    If you store the number on the template sheet itself how would you determine what the next number should be as it will always be that value +1. That means the number used would be the same the second time the code is run. Should the code also update the template with the next number?

  9. #9
    Registered User
    Join Date
    10-17-2013
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Auto Running Number in Excel Worksheet

    Hi Andy.. On this note, will that be possible if i store the starting number in summary sheet.
    Last edited by Yap Chin Joo; 10-28-2013 at 01:12 PM. Reason: Spelling

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Auto Running Number in Excel Worksheet

    The number is taken from B1 on summary sheet.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    10-17-2013
    Location
    Kuala Lumpur
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Auto Running Number in Excel Worksheet

    Hi Andy.. This is a PERFECT solution!!

  12. #12
    Registered User
    Join Date
    10-23-2013
    Location
    Dubai
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Auto Running Number in Excel Worksheet

    Hi CJ Yap & Andy,
    I had listed a similar query, and I found that the excel template shown can be used. I have borrowed this, and thank you you so much. I have a query: what if the PO ran to multiple pages? Wouldnt it affect the summary sheet? Is there a way around this?

    Thank you
    Reshma

  13. #13
    Valued Forum Contributor ratcat's Avatar
    Join Date
    03-07-2008
    Location
    Rural NSW, Australia
    MS-Off Ver
    Vista 2007
    Posts
    1,111

    Re: Auto Running Number in Excel Worksheet

    G'day reshm9077 and welcome to the forum,

    Please take an extra minute to read the forum rules. Forum Rules link

    Especially

    2. Don't post a question in the thread of another member -- start your own. If you feel it's particularly relevant, provide a link to the other thread. You may include up to 3 links to other URLs in a single post, no more, so only link to the relevant pages.
    Have I made you happy ??? If yes, please make me happy by pressing the http://www.excelforum.com/images/buttons/reputation-40b.png Add Reputation button in my post.
    Please don't forget to do the same to other contributors of this forum.

    Thanks
    I don't void confusion, I create it

+ 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. how to auto increment a number each time i open the worksheet
    By JE McGimpsey in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 12:05 PM
  2. how to auto increment a number each time i open the worksheet
    By fred rondak in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  3. how to auto increment a number each time i open the worksheet
    By fred rondak in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  4. how to auto increment a number each time i open the worksheet
    By fred rondak in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  5. [SOLVED] How do I add an auto number to a worksheet
    By peterm in forum Excel General
    Replies: 1
    Last Post: 02-01-2005, 07:06 PM

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