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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

RalphA

Well-known Member
Joined
May 14, 2003
Messages
3,829
I'm not into VBA, but, are spreadsheets JobDetails and ProductDetails two, diferent spreadsheets, or is there some kind of error here?
 

Forum statistics

Threads
1,141,681
Messages
5,707,791
Members
421,527
Latest member
Tamiwsw

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
Top