+ Reply to Thread
Results 1 to 4 of 4

Print Userform: Control number of Copies Printed

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-28-2009
    Location
    Portland, Maine
    MS-Off Ver
    Excel 2003
    Posts
    102

    Print Userform: Control number of Copies Printed

    Hello,
    I have a macro that selects and prints a range of interest (works perfectly)

    However, I have found that the people who are using this frequently have to print more than one copy of the selected range. So they either have to hit the button 15 times or select the range manually and print (which the majority of the end users do not know how to do. They inevitably print the whole sheet and it becomes unreadable).

    What I would like to do is expand on my current macro to control the number of copies printed with a UserForm.

    My current print macro:
    Sub PRINT_OPEN_ACTIONS()
        Dim wks As Worksheet
        Dim LtHdr
        Dim CntHdr
        LtHdr = Range("LEAD").Value
        CntHdr = Range("PROJECT").Value
    
        Sheet2.Unprotect
        Application.ScreenUpdating = False
    
        For Each wks In Worksheets
            With wks.PageSetup
                .LeftHeader = "Project Lead: " & LtHdr
                .CenterHeader = "&"" Times New Roman,Italic""" & CntHdr & ":Action Plan"
                .RightHeader = "MMP"
                End With
        Next wks
        
        Selection.AutoFilter Field:=8, Criteria1:="="
        Range(ActiveSheet.Range("A2"), ActiveSheet.Range("b2").End(xlDown).Offset(0, 6)).PrintOut _
        Copies:=1, Preview:=True, Collate:=True
                
    Sheet2.protect AllowSorting:=True, AllowFiltering:=True
    Application.ScreenUpdating = True
    End Sub
    Any help would be very much appreciated. An example of the file is attached.
    Thanks!
    Attached Files Attached Files
    Last edited by yunesm; 09-15-2010 at 08:34 AM. Reason: Solved

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

    Re: Print Userform: Control number of Copies Printed

    Something like
    Sub PRINT_OPEN_ACTIONS()
        Dim wks As Worksheet
        Dim LtHdr
        Dim CntHdr
        Dim Pgs
        LtHdr = Range("LEAD").Value
        CntHdr = Range("PROJECT").Value
    
        Sheet2.Unprotect
        Application.ScreenUpdating = False
    
        For Each wks In Worksheets
            With wks.PageSetup
                .LeftHeader = "Project Lead: " & LtHdr
                .CenterHeader = "&"" Times New Roman,Italic""" & CntHdr & ":Action Plan"
                .RightHeader = "MMP"
                End With
        Next wks
        Pgs = InputBox("How many copies?")
        If Pgs < 1 Or Pgs = "" Then Pgs = 1
        Selection.AutoFilter Field:=8, Criteria1:="="
        Range(ActiveSheet.Range("A2"), ActiveSheet.Range("b2").End(xlDown).Offset(0, 6)).PrintOut _
        Copies:=Pgs, Preview:=True, Collate:=True
                
    Sheet2.protect AllowSorting:=True, AllowFiltering:=True
    Application.ScreenUpdating = True
    End Sub
    Hope that helps.

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

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    10-28-2009
    Location
    Portland, Maine
    MS-Off Ver
    Excel 2003
    Posts
    102

    Re: Print Userform: Control number of Copies Printed

    Perfect, I didn't realize it was so simple!

    Thanks!!!

  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 Userform: Control number of Copies Printed

    No problem

    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