Help with a printing code!

crinkle

New Member
Joined
Feb 16, 2006
Messages
32
Hi can anyone help me make this code work this is sort of what i want to happen, it is for printing various pages depending if there is information on them, if there is not i dont want to print that page. Also i need them to print as 1 job and not individual pages.
Code:
Sub PrintOrderNew()

 
Application.ScreenUpdating = False
    Sheets("JobDetails").Visible = True
    Sheets("ProductOrder").Visible = True
    Sheets("AccessoryOrder").Visible = True
    
    If Range("OrderDetails!D2") > "0" And Range("ProductOrder!B11") > "0" And Range("AccessoryOrder!B11") > "0" Then
    Range("JobDetails!A1:J43" And "ProductOrder!A1:G51" And "AccessoryOrder!A1:G51").Select
    Selection.PrintPreview
End If
    If Range("OrderDetails!D2") > "0" And Range("ProductOrder!B11") > "0" And Range("AccessoryOrder!B11") = "0" Then
    Range("JobDetails!A1:J43" And "ProductOrder!A1:G51").Select
    Selection.PrintPreview
End If
    If Range("OrderDetails!D2") > "0" And Range("ProductOrder!B11") = "0" And Range("AccessoryOrder!B11") = "0" Then
    Range("JobDetails!A1:J43").Select
    Selection.PrintPreview
End If
    If Range("OrderDetails!D2") > "0" And Range("AccessoryOrder!B11") > "0" And Range("ProductOrder!B11") = "0" Then
    Range("JobDetails!A1:J43", "AccessoryOrder!A1:G51").Select
    Selection.PrintPreview
End If
    
    
    Sheets("JobDetails").Visible = False
    Sheets("ProductOrder").Visible = False
    Sheets("AccessoryOrder").Visible = False
    Sheets("EclipseOrderPage").Select
    Range("A1").Select
End Sub
Thanks
Chris
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I'm not into VBA, but, are spreadsheets JobDetails and ProductDetails two, diferent spreadsheets, or is there some kind of error here?
 
Upvote 0

Forum statistics

Threads
1,213,485
Messages
6,113,931
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top