View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Format Page setup for multiple worksheet in a workbook

Sub Macro1()

For Each sht In Sheets
With sht.Cells.Font
.Name = "Arial"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Bold = False
.Italic = False
.Underline = xlUnderlineStyleNone
End With

With sht.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.PrintArea = ""
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
Next sht
End Sub

"CB" wrote:

I have multiple (over 30) worksheets in a workbook. I need some VBA that
will go and set the following for all worksheets in the workbook:

Font = Arial
Font Style = Regular
Font Size = 10
Left Margin = 1/2"
Right Margin = 1/2"
Top Margin = 1"
Bottom Margin = 1"
Footer = Blank
Header = Sept Sales
Orientation = Landscape
Paper Size = Letter

Can anyone help me automate this as I will have this issue every mont. It
takes a lot of time to format each sheet manually.

Thanks in advance for your help.

Cheers.