View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
CB CB is offline
external usenet poster
 
Posts: 60
Default Format Page setup for multiple worksheet in a workbook

Thank you so much. I will give it a try.

Cheers.

"Derek P." wrote:

The For Each, and With operations will make this a breeze for you.

Something like this:
Dim current_sheet As Variant

'Loop through each sheet in the workbook
For Each current In ThisWorkbook.Sheets
'Format font
With current.Cells
With .Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
End With
End With
'Format page setup
With current.PageSetup
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.Orientation = xlLandscape
.PaperSize = xlPaperLetter
.CenterHeader = "Sept Sales" 'This could and should be modified to
become
'dynamic
.CenterFooter = ""
End With
Next current_sheet


There you go.

D.P.

"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.