ed.ayers315
Board Regular
- Joined
- Dec 14, 2009
- Messages
- 166
Hi forum goes,
Need help on the following code. I pieced this together from other posts. I am trying to get this long print range to only print the sections that have information to print, if the next section does not have printable information, it should move to the next section until it has printed all ranges that fit my criteria and at the end reset the printrange to "".
I am missing or have end with's or missing end if's or have it really messed up.
Thanks in advance for any any help.
Need help on the following code. I pieced this together from other posts. I am trying to get this long print range to only print the sections that have information to print, if the next section does not have printable information, it should move to the next section until it has printed all ranges that fit my criteria and at the end reset the printrange to "".
I am missing or have end with's or missing end if's or have it really messed up.
Thanks in advance for any any help.
Code:
[HTML]Public Sub PRINT_COVERPAGE_CSR()
With Sheets("SERVICE_REPORT")
.PageSetup.PrintArea = "$B$1:$I$" & .Range("N18").Value
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$3"
.PrintTitleColumns = ""
.LeftFooter = Range("$B$208:$b$209").Text
.RightFooter = Range("$F$208:$f$209").Text
.PrintOut
'PRINT SECTION 2 IF N57 >0
If Range("N57").Value > "0" Then
With Sheets("SERVICE_REPORT")
.PageSetup.PrintArea = "$B$19:$I$" & .Range("N57").Value
With ActiveSheet.PageSetup
.PrintTitleRows = "$19:$20"
.PrintTitleColumns = ""
.PrintOut
'PRINT SECTION 3 IF N89>0
If Range("N89").Value > "0" Then
With Sheets("SERVICE_REPORT")
.PageSetup.PrintArea = "$B$58:$I$" & .Range("N89").Value
With ActiveSheet.PageSetup
.PrintTitleRows = "$58:$59"
.PrintTitleColumns = ""
.PrintOut
'PRINT SECTION 4A IF N96>0
If Range("N96").Value > "0" Then
With Sheets("SERVICE_REPORT")
.PageSetup.PrintArea = "$B$91:$I$" & .Range("N96").Value
With ActiveSheet.PageSetup
.PrintTitleRows = "$91:$92"
.PrintTitleColumns = ""
.PrintOut
'PRINT SECTION 4B IF N101>0
If Range("N101").Value > "0" Then
With Sheets("SERVICE_REPORT")
.PageSetup.PrintArea = "$B$97:$I$" & .Range("N101").Value
With ActiveSheet.PageSetup
.PrintTitleRows = "$97:$97"
.PrintTitleColumns = ""
.PrintOut
'PRINT SECTION 5 IF N111>0
If Range("N111").Value > "0" Then
With Sheets("SERVICE_REPORT")
.PageSetup.PrintArea = "$B$102:$I$" & .Range("N111").Value
With ActiveSheet.PageSetup
.PrintTitleRows = "$102:$102"
.PrintTitleColumns = ""
.PrintOut
'PRINT SECTION 6 IF N118>0
If Range("N118").Value > "0" Then
With Sheets("SERVICE_REPORT")
.PageSetup.PrintArea = "$B$112:$I$" & .Range("N118").Value
End With
With ActiveSheet.PageSetup
.PrintTitleRows = "$112:$114"
.PrintTitleColumns = ""
.PrintOut
'PRINT VESSELS SUMMARY IF N149>0
If Range("N149").Value > "0" Then
With Sheets("SERVICE_REPORT")
.PageSetup.PrintArea = "$B$119:$I$" & .Range("N149").Value
With ActiveSheet.PageSetup
.PrintTitleRows = "$119:$120"
.PrintTitleColumns = ""
.PrintOut
'PRINT LINES SUMMARY IF N180>0
If Range("N180").Value > "0" Then
With Sheets("SERVICE_REPORT")
.PageSetup.PrintArea = "$B$150:$I$" & .Range("N180").Value
With ActiveSheet.PageSetup
.PrintTitleRows = "$150:$151"
.PrintTitleColumns = ""
.PrintOut
'PRINT HT SUMMARY IF N197>0
If Range("N197").Value > "0" Then
With Sheets("SERVICE_REPORT")
.PageSetup.PrintArea = "$B$181:$I$" & .Range("N197").Value
With ActiveSheet.PageSetup
.PrintTitleRows = "$181:$182"
.PrintTitleColumns = ""
.PrintOut
'PRINT MEMBRANE SUMMARY IF N204>0
If Range("N204").Value > "0" Then
With Sheets("SERVICE_REPORT")
.PageSetup.PrintArea = "$B$198:$I$" & .Range("N204").Value
With ActiveSheet.PageSetup
.PrintTitleRows = "$198:$199"
.PrintTitleColumns = ""
.PrintOut
'PRINT ATTACHED PICTURES SUMMARY IF N207>0
If Range("N207").Value > "0" Then
With Sheets("SERVICE_REPORT")
.PageSetup.PrintArea = "$B$204:$I$" & .Range("N207").Value
With ActiveSheet.PageSetup
.PrintTitleRows = "PICTURE ATTACHED"
.PrintTitleColumns = ""
.PrintOut
End With
End Sub[/HTML]