ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   fit to one page (https://www.excelbanter.com/excel-programming/439280-fit-one-page.html)

J.W. Aldridge

fit to one page
 
Attempting to fit all data onto one page, with landscape orientation.
Possible error with line:
ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight,
RegionIndex:=1

(Any sugestions?)

Sub Macro6()
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Orientation = xlLandscape
End With
ActiveWindow.View = xlPageBreakPreview
ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight,
RegionIndex:=1
ActiveWindow.SmallScroll Down:=-30
Range("A2").Select
End Sub

Thanx

Don Guillett[_2_]

fit to one page
 
Try

Sub printareamacro()
With ActiveSheet.PageSetup
.PrintArea = Range("a1").CurrentRegion.Address
.Orientation = xlLandscape
.CenterHorizontally = True
.CenterVertically = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ActiveSheet.PrintPreview
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"J.W. Aldridge" wrote in message
...
Attempting to fit all data onto one page, with landscape orientation.
Possible error with line:
ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight,
RegionIndex:=1

(Any sugestions?)

Sub Macro6()
Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Orientation = xlLandscape
End With
ActiveWindow.View = xlPageBreakPreview
ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight,
RegionIndex:=1
ActiveWindow.SmallScroll Down:=-30
Range("A2").Select
End Sub

Thanx




All times are GMT +1. The time now is 12:16 AM.

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