Print Command Button Quandary

D

Daniel

I use Excel 2000.

I have a worksheet that has 4 command buttons:

ALL ORDERS
OPEN ORDERS
CLOSED ORDERS
PRINT

The 1st 3 buttons filter the worksheet as designed. My PRINT button
will correctly print the filtered items ONLY - if I 1st select EITHER
the OPEN ORDERS button or the CLOSED ORDERS button (and then press my
Print command button).

My problem occurs if the ALL ORDERS button has been selected followed
by my PRINT command button. The problem is that every row prints out
whether or not the row is blank. If I change the code for the event
procedure for the PRINT button to exclude no blanks, then the OPEN
ORDERS and CLOSED ORDERS filtering is nullified.

Can my problem be resolved with just 1 PRINT button? If so, your help
would be appreciated.
Thanks.
 
L

Lance

Without seeing your code, it would appear that you could
set the option to exclude blanks (or not) in your macros
assigned to open,closed and All orders. The when you
print the last selection made will have set the default.

Lance
 
D

Daniel

Thanks Lance for your reply.

Here is the event procedure code that activates when the PRINT button
is pressed:

Private Sub PrintButton_Click()
Range("B56:I200").Select
Range("I200").Activate
ActiveSheet.PageSetup.PrintArea = "$B$56:$I$200"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Range("A59").Select
End Sub

Note: There is a hidden array from rows 1 thru 55.


Code for ALL ORDERS Button:

Private Sub AllOrdersButton_Click()
Rows("60:199").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1
Range("A59").Select
Selection.AutoFilter
End Sub


Code for OPEN ORDERS Button:

Private Sub OpenOrdersButton_Click()
Rows("60:199").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="NO"
Range("A59").Select
End Sub


Code for CLOSED ORDERS Button:

Private Sub ClosedOrdersButton_Click()
Rows("60:199").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="YES"
Range("A59").Select
End Sub

If I include code to exclude blanks in the Print button procedure, it
will ONLY exclude blanks and not descriminate between open or closed
orders. Therefore adding this code fixes the All Orders printout but
now incorrectly prints out both the Open orders and Closed Orders. I
hope I've made myself clear.
 

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