+ Reply to Thread
Results 1 to 10 of 10

Print template with changing numbering

Hybrid View

  1. #1
    Registered User
    Join Date
    09-05-2011
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2010
    Posts
    9

    Print template with changing numbering

    Hi, guys,

    I need help. The issue is that I have a template, I need to print 120 copies of it. The whole structure of the template does not change except for the numbers of the each template, for example, first printed template should have a number QSA1, second QSA2, etc.
    It can be done manually, however changing numbers in each template and printing them will take a lot of time.

    Thank you
    Last edited by Anar; 11-28-2011 at 04:45 AM.

  2. #2
    Registered User
    Join Date
    11-09-2011
    Location
    Karlstad, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: Print template with changing numberin

    Hi

    If the the template is just 1 page you maybe could use page numbering?

  3. #3
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Print template with changing numberin

    Can u attach a sample file?

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Print template with changing numberin

    It can be done with VBA

    Option Explicit
    
    Sub PrintSht()
    Dim iX As Integer
    Dim PgCopy As String
    For iX = 1 To 120
    PgCopy = "QSA" & iX
    Cells(1, 1).Value = PgCopy '<- puts number in A1
    ActiveSheet.PrintPreview '<just for testing
    'ActiveSheet.PrintOut    '<- print sheet
    Next iX
    End Sub
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    09-05-2011
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Print template with changing numberin

    Thank you, all
    Especially royUK, your code works well.
    Could you just add one more line for option to select number of copies, for example, 10 instead of 120
    Last edited by Anar; 11-25-2011 at 07:23 AM.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Print template with changing numberin

    Here's a similar example that you could adapt

  7. #7
    Registered User
    Join Date
    09-05-2011
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Print template with changing numberin

    royUK, thank you for example.
    I prefer using your new code.
    How can I add prompt option (inputbox) for both first and last numbers of iX in the code?

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Print template with changing numbering

    Try this
    Option Explicit
    Sub PrintSht()
        Dim iX As Integer
        Dim FirstNumber As Integer
        Dim LastNumber As Integer
        Dim PgCopy As String
    
        FirstNumber = Application.InputBox(prompt:="Enter first number", Type:=1)
        If FirstNumber > 1 Then GoTo exit_proc
        
        LastNumber = Application.InputBox(prompt:="Enter last number", Type:=1)
        If LastNumber > 1 Then GoTo exit_proc
    
        For iX = FirstNumber To LastNumber
            PgCopy = "QSA" & iX
            Cells(1, 1).Value = PgCopy    '<- puts number in A1
            ActiveSheet.PrintPreview    '<just for testing
            'ActiveSheet.PrintOut    '<- print sheet
        Next iX
        Exit Sub
    exit_proc:
        'no number entered
        MsgBox "You must enter a number", vbCritical, "Cancelled"
    End Sub
    Last edited by royUK; 11-27-2011 at 04:08 AM.

  9. #9
    Registered User
    Join Date
    09-05-2011
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Print template with changing numbering

    Thank you , a lot, royUK

    You are genious.

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Print template with changing numbering

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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