Results 1 to 7 of 7

Increment serial number for each printed page

Threaded View

  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:
    Sub PrintCopies_ActiveSheet()
    Dim CopiesCount As Long
    Dim CopieNumber As Long
    CopiesCount = Application.InputBox("How many Sheets do you want?", Type:=1)
    CopieStart = Application.InputBox("What number do you want to start from ?", Type:=1)
     
    For CopieNumber = 1 To CopiesCount
    With ActiveSheet
    'number in cell E30 (prints "n")
    .Range("E30").Value = CopieNumber
     
    'number in cell E30 (prints "n of z")
    '.Range("E30").Value = CopieNumber & " of " & CopiesCount
     
    'number in the footer (prints "n of z")
    '.PageSetup.LeftFooter = CopieNumber & " of " & CopiesCount
     
    'Print the sheet
    .PrintOut
    End With
    Next CopieNumber
    End Sub


    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

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