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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Woorkbook(1).PageSetup 1

Status
Not open for further replies.

rajltd

IS-IT--Management
Sep 25, 2003
38
GB
Hi,

The following command will help me change the pagesetup for the first sheet of the workbook.

With Worksheets(1).PageSetup

.LeftHeader = ""
.CenterHeader = "&A"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "Page &P"
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
' .FitToPagesTall = 1
End With


Can anyone help me, if i want the same thing to happen to the whole workbook instead of only first sheet of the workbook.

I have also tried

With ActiveSheet.PageSetup

Other commands remaining the same.

But its no use for me, as I want this to happen for all sheets of the workbook.

This is part of the excel marco.

Thanks for help.

Raj
 

You may want to turn off screen updating as shown below, and remove all the lines from the above that aren't changing anything.

You can put your code in the loop:

Dim sht as worksheet
application.screenupdating = false
For each sht in worksheets
sht.select
(Enter your code here)
next sht
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top