PRINT command button

J

Jeff F

I currently print our purchase orders using a command button with code:

Private Sub CommandButton1_Click()
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=2, Copies:=2, Collate _
:=True
End Sub

This works great but sometimes the PO is only one page. I don't want it to
print the 2nd page. How do I need to change this?
(The PO is generated using "create po" command button)

Private Sub CommandButtoncreate_Click()

Range("a1:I227").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"k1:K2"), CopyToRange:=Worksheets("Purchase
Order").Range("$a$9:$f$9"), Unique:=False

With Worksheets("Purchase Order")
With .Range("A10:F100")
..sort Key1:=.Range("c10"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Sheets("Purchase Order").Activate

End With
End With

End Sub

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top