Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Worksheets Print settings 1

Status
Not open for further replies.

yumbelie

Programmer
Dec 31, 2002
96
GB
Hi, My problem is this: I create a new workbook with multiple worksheets compiled from a source workbook. But the thing is all the sheets are setup for printing in Portrait, not landscape. This means I have to manually go through (up to 40 sheets) changing the settings from Portrait to Landscape. Is their anyway I can automate this procedure? So all the pages default to landscape?. Also, if that is possible, how would you alter page preferences for each sheet? such as the margin size etc.

Thanks Guys!

Joseph.
 
Hi
This should get you started

Code:
Sub lime()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
With ws.PageSetup
    .Orientation = xlLandscape
End With
Next
End Sub

The best thing to do is record yourself changing the settings in page setup and pick out the bits you want
e.g. .LeftMargin = whatever etc.

You may not want your code in the book you are working in in which case change "ThisWorkbook" to Workbooks("WhateverName")

RYMB

HappyFriday
;-) If a man says something and there are no women there to hear him, is he still wrong?
 
Hey Joseph,
If Loomah's post was helpful to you, you should consider awarding a star!
Rob
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top