ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PRINT command button (https://www.excelbanter.com/excel-programming/396136-print-command-button.html)

Jeff F

PRINT command button
 
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


All times are GMT +1. The time now is 01:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com