Dim wks as worksheet
for each wks in activewindow.selected sheets
wks.activate
your code here
next wks
or
Dim wks as worksheet
for each wks in activeworkbook.worksheets 'to get all the sheets
wks.activate
your code here
next wks
> Please help,
>
[quoted text clipped - 23 lines]
>
> Ross

Signature
Dave Peterson
Ron de Bruin - 23 May 2008 20:40 GMT
For the OP
See also this code from John Green for faster code
http://www.mcgimpsey.com/excel/udfs/pagesetup.html

Signature
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
> Dim wks as worksheet
> for each wks in activewindow.selected sheets
[quoted text clipped - 37 lines]
>>
>> Ross
Ross - 23 May 2008 20:45 GMT
Dave,
Thank you for your response:
To clerify, I have code that runs prior to the code pasted into this "Blog"
that correctly selects all of the sheets/tabs prior to running the
formatting code:
This runs to select the sheets:
'*********************
Sub Select_All_Sheets()
'*********************
Dim Sh As Worksheet
For Each Sh In ActiveWorkbook.Worksheets
Sh.Select False
Next Sh
End Sub
The problem is that when the code previously pasted runs, it "de-selects"
all of the previously selected sheets and formats only one active sheet and
not the 75 previously selected sheets.
That is why I think that "With ActiveSheet.PageSetup" only allows one sheet
at a time. AS previously described, I can stop the code before "With
ActiveSheet.PageSetup" and manually adjust all 75 sheets at once (say change
from portrait to landscape). I need code that will allow "With
ActiveSheet(S).PageSetup" (plural) instead of singular.
Does this make sense?
Thanks again!
Ross
> Dim wks as worksheet
> for each wks in activewindow.selected sheets
[quoted text clipped - 37 lines]
> >
> > Ross
Dave Peterson - 23 May 2008 21:54 GMT
It makes perfectly good sense. But doesn't my suggestion may sense, too?
> Dave,
>
[quoted text clipped - 74 lines]
> >
> > Dave Peterson

Signature
Dave Peterson
Hi Ross
You can not edit headers for all sheets at once. Try this instead:
For Each sh In ThisWorkbook.Sheets
With sh.PageSetup
.LeftHeader = ""
.CenterHeader = "&A"
End With
Next
Regards,
Per
> Please help,
>
[quoted text clipped - 24 lines]
>
> Ross