Announcement

Collapse
No announcement yet.

VBA to print number of copies based on cell value

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VBA to print number of copies based on cell value



    Hello

    VBA newbie here,

    I found a code on the forum to print copies based on cell value, but I need to be able to specify what sheet to print

    So I input number in cell on sheet 1 press button with assigned macro that would print out that number of copies of Sheet 2.

    Any help would be greatly appreciated

    Code:
    Sub Macro3()
    
        For Each Worksheet In ActiveWorkbook.Worksheets
    
            With Sheets(Worksheet.Name)
    
                If .Visible = xlSheetVisible And _
                    IsNumeric(.Range("A1").Value) = True And _
                   .Range("A1").Value > 0 Then
                        .PrintOut Copies:=.Range("A1").Value, _
                         IgnorePrintAreas:=False
                End If
    
            End With
    
        Next Worksheet
    
    End Sub

  • #2
    Code:
    Option Explicit
    
    Sub PrintOut_Method_All_Parameters_Listed()
    'List of all of the optional parameters for printing an Excel spreadsheet using the PrintOut method
    
    Worksheets.PrintOut _
    From:=Range("F8"), _
    To:=Range("F9"), _
    Copies:=Range("F10"), _
    Preview:=False, _
    ActivePrinter:="", _
    PrintToFile:=False, _
    Collate:=True, _
    {PrToFileName:="", _
    IgnorePrintAreas:=False
    
    End Sub

    Comment


    • #3
      https://www.mrexcel.com/forum/excel-...fied-cell.html

      Comment


      • #4


        Thank you Jollvanes that's just what i needed

        Comment

        Working...
        X