Hi,
I am trying to combine two print areas and have them print out one after another as if there was no break between them on the spreadsheet. My problem is that the first print area which is only 1 row is being given a whole page.
Here is my current code:
(top= 10; bottom = 153)
Function PrintSection(top As Integer, bottom As Integer)
Dim headerRange As Range
Dim bodyRange As Range
Dim unionRange As Range
'Set print area
Set headerRange = Range("$F$3:$H$3")
Set bodyRange = Range("$F$" & top & ":$H$" & bottom)
Set unionRange = Application.Union(headerRange, bodyRange)
With ActiveSheet
.PageSetup.PrintArea = unionRange.Address
End With
'show print dialog
Application.Dialogs(xlDialogPrint).Show
'clear print area
'ActiveSheet.PageSetup.PrintArea = ""
End Function
Anyone know why this is occurring?
Thanks!
I am trying to combine two print areas and have them print out one after another as if there was no break between them on the spreadsheet. My problem is that the first print area which is only 1 row is being given a whole page.
Here is my current code:
(top= 10; bottom = 153)
Function PrintSection(top As Integer, bottom As Integer)
Dim headerRange As Range
Dim bodyRange As Range
Dim unionRange As Range
'Set print area
Set headerRange = Range("$F$3:$H$3")
Set bodyRange = Range("$F$" & top & ":$H$" & bottom)
Set unionRange = Application.Union(headerRange, bodyRange)
With ActiveSheet
.PageSetup.PrintArea = unionRange.Address
End With
'show print dialog
Application.Dialogs(xlDialogPrint).Show
'clear print area
'ActiveSheet.PageSetup.PrintArea = ""
End Function
Anyone know why this is occurring?
Thanks!