+ Reply to Thread
Results 1 to 7 of 7

Increment serial number for each printed page

  1. #1
    Registered User
    Join Date
    09-22-2011
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2007
    Posts
    18

    Increment serial number for each printed page

    Hi Folks!

    I have what I guess is a pretty straightforward question but my limited knowledge of macros means that I need some help!

    I am trying to increment a number in a cell by one each time a page is printed. So for example I want 10 pages, I get the same sheet, but with 1 on the first, 2 on the second and so on.

    I have nicked / borrowed / plagiarised a bit of code that will do this fine, but only if the number I start with is 1. I really need the number to be selectable by the operator (the current range of numbers is 13863 for example and each print wants to increment the number from there).

    The code I have goes like this:
    Please Login or Register  to view this content.


    I have added the line "CopieStart = Application.InputBox("What number do you want to start from ?", Type:=1)" and this does prompt me to enter the starting number.

    I now need to have the code use this starting number as the first of the incremental series.

    Does that make sense I hope so.

    Any help very gratefully received.
    Cheers,
    Fungijus.
    Last edited by Fungijus; 09-22-2011 at 05:55 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Increment serial number for each printed page

    Hello Fungijus,

    Welcome to the Forum!

    It looks like you need to replace the 1 with CopieStart.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    09-22-2011
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Increment serial number for each printed page

    Quote Originally Posted by Leith Ross View Post
    Hello Fungijus,

    Welcome to the Forum!

    It looks like you need to replace the 1 with CopieStart.
    Thanks for the welcome Leith - and for the advice.

    I had tried that earlier as it was what I had in mind when I added the extra line regarding CopieStart. I couldn't get it to work earlier on, then I tried it just now and it was great!

    Happy Days, or so I thought...In fact what this does now is start at the prompted CopieStart value, but only increments up to the print quantity value.
    For instance, if I add 3 as the print quantity, and 2 as the CopieStart value, it only prints two sheets and stops at 3 (whereas I really wanted 3 copies, stopping at 4).

    This would explain why I couldn't get it to work earlier, as I entered the start value as 13863 and of course didn't want that many copies, so it never got there, and looked as if it had done nothing.

    Grateful to hear your thoughts on this one.
    Cheers,
    J.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Increment serial number for each printed page

    Hello ,

    You just need a simple math correction. Change the For statement to what is below.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-22-2011
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Increment serial number for each printed page

    That's marvellous that is!

    Added the code you suggested and it works a treat.

    Thanks very much for your help - and you patience

    I'll be back...next time!

    Cheers,
    J.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Increment serial number for each printed page

    Hello Fungijus,

    Glad to know it is working.

  7. #7
    Registered User
    Join Date
    09-22-2011
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Increment serial number for each printed page

    Last edited by Fungijus; 09-26-2011 at 05:47 PM. Reason: Removed duplicate information - re posted

+ 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