ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting PrintArea by using Named Ranges (https://www.excelbanter.com/excel-programming/289226-setting-printarea-using-named-ranges.html)

Oren Klaber

Setting PrintArea by using Named Ranges
 
I'm a newbie and I'm having difficulty assigning a named range to a
print area.

Here's my attempt but its not working. It keeps on showing the entire
worksheet as the print area. I've tried many iterations of this concept
but can't seem to solve it. Any thoughts.


Dim rng As Range
Set rng = Range(Application.Names("WT_Souvenir_PrintRange"))
Application.Goto Reference:=rng

Application.StatusBar = "Beginning page setup"

With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$6"
.PrintArea = rng
.CenterFooter = "Childhood Memories"
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = False
End With
ActiveWindow.SelectedSheets.PrintPreview
End Sub

Tom Ogilvy

Setting PrintArea by using Named Ranges
 
..PrintArea = rng.Address(external:=True)

--
Regards,
Tom Ogilvy


Oren Klaber wrote in message
...
I'm a newbie and I'm having difficulty assigning a named range to a
print area.

Here's my attempt but its not working. It keeps on showing the entire
worksheet as the print area. I've tried many iterations of this concept
but can't seem to solve it. Any thoughts.


Dim rng As Range
Set rng = Range(Application.Names("WT_Souvenir_PrintRange"))
Application.Goto Reference:=rng

Application.StatusBar = "Beginning page setup"

With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$6"
.PrintArea = rng
.CenterFooter = "Childhood Memories"
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = False
End With
ActiveWindow.SelectedSheets.PrintPreview
End Sub




Oren Klaber

Setting PrintArea by using Named Ranges
 
Thanks Tom. That solved the problem.

Oren


"Tom Ogilvy" wrote in message ...
.PrintArea = rng.Address(external:=True)

--
Regards,
Tom Ogilvy


Oren Klaber wrote in message
...
I'm a newbie and I'm having difficulty assigning a named range to a
print area.

Here's my attempt but its not working. It keeps on showing the entire
worksheet as the print area. I've tried many iterations of this concept
but can't seem to solve it. Any thoughts.


Dim rng As Range
Set rng = Range(Application.Names("WT_Souvenir_PrintRange"))
Application.Goto Reference:=rng

Application.StatusBar = "Beginning page setup"

With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$6"
.PrintArea = rng
.CenterFooter = "Childhood Memories"
.Orientation = xlLandscape
.FitToPagesWide = 1
.FitToPagesTall = False
End With
ActiveWindow.SelectedSheets.PrintPreview
End Sub



All times are GMT +1. The time now is 01:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com