View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jeff F Jeff F is offline
external usenet poster
 
Posts: 1
Default 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