R
Rookie 1st class
This ALMOST works. I use File, Print, Entire workbook with a "Page of Pages"
header. It contains a cover page and 4 survey sheets(temperatures) with zero
to 6 pages depending on survey time and number of thermocouples. How do I not
print unused sheets? How do I adjust "Pages" to not count sheets without an
entry in Range("B15")?
This prints blank pages for unused sheets and is 5 pages minimum. Actually 2
pages (cover and 1 temperature with 12 T/Cs under 1 hr 16 min) is more common.
Private Sub CommandButton2_Click()
Range("F9").Select
Selection = InputBox(Prompt:="[Type & Enter]" & Chr(13) & "The row
number to the left of the Summary Start Time.", Title:="SUMMARY START TIME",
Default:=Range("F9"))
Range("A15:AY92").Select
Selection.HorizontalAlignment = xlCenter
If Range("B15") <> "" Then
ActiveSheet.PageSetup.RightHeader = "&""Arial Narrow,Regular""&8Page
&P of &N"
Else
ActiveSheet.PageSetup.RightHeader = ""
End If
If Range("AJ54") <> "" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$AY$92"
ElseIf Range("S54") <> "" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$AH$92"
ElseIf Range("B54") <> "" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$Q$92"
ElseIf Range("AJ15") <> "" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$AY$53"
ElseIf Range("S15") <> "" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$AH$53"
ElseIf Range("B15") <> "" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$Q$53"
Else
ActiveSheet.PageSetup.PrintArea = "$P$1:$Q$1"
End If
n = Range("F9")
Cells(n, 1).Select
Selection.Name = "TUS4SmmryRw"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
Thanks in advance; Lou
header. It contains a cover page and 4 survey sheets(temperatures) with zero
to 6 pages depending on survey time and number of thermocouples. How do I not
print unused sheets? How do I adjust "Pages" to not count sheets without an
entry in Range("B15")?
This prints blank pages for unused sheets and is 5 pages minimum. Actually 2
pages (cover and 1 temperature with 12 T/Cs under 1 hr 16 min) is more common.
Private Sub CommandButton2_Click()
Range("F9").Select
Selection = InputBox(Prompt:="[Type & Enter]" & Chr(13) & "The row
number to the left of the Summary Start Time.", Title:="SUMMARY START TIME",
Default:=Range("F9"))
Range("A15:AY92").Select
Selection.HorizontalAlignment = xlCenter
If Range("B15") <> "" Then
ActiveSheet.PageSetup.RightHeader = "&""Arial Narrow,Regular""&8Page
&P of &N"
Else
ActiveSheet.PageSetup.RightHeader = ""
End If
If Range("AJ54") <> "" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$AY$92"
ElseIf Range("S54") <> "" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$AH$92"
ElseIf Range("B54") <> "" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$Q$92"
ElseIf Range("AJ15") <> "" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$AY$53"
ElseIf Range("S15") <> "" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$AH$53"
ElseIf Range("B15") <> "" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$Q$53"
Else
ActiveSheet.PageSetup.PrintArea = "$P$1:$Q$1"
End If
n = Range("F9")
Cells(n, 1).Select
Selection.Name = "TUS4SmmryRw"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
Thanks in advance; Lou