fit to one page

J

J.W. Aldridge

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
 
D

Don Guillett

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top