I have several worksheets that have identical formats.
When I change the print range of 1 worksheet, I typically want to change the
print range of them all. Is there any easy way to do this?
Excel 2000 won't let me group and change them all at once. Maybe there's a
VBA solution?
Thanks
Al
Al
Unfortunately setting the print area on grouped sheets is not an option
without using VBA.
Code from Bob Flanagan for setting same print area on grouped sheets.
NOTE: Set the print area on ActiveSheet then Group the sheets and run the
macro.
Note: after print area is set you will most likely have to re-group to set
margins.
Sub Set_Print_Area_On_All_Selected_Sheets()
Dim tempS As String, oSheets As Object
Dim curSheet As Worksheet, oSheet As Worksheet
Dim iResponse
Application.ScreenUpdating = False
iResponse = MsgBox(prompt:= _
"Select OK to set the print area on all " & _
"selected sheets the same as the print " & _
"area on this sheet. If you have not selected " & _
"any sheets, then all worksheets will be set.", _
Buttons:=vbOKCancel)
If iResponse = vbCancel Then End
'store info
tempS = ActiveSheet.PageSetup.PrintArea
'set an object variable to refer to the sheets to be set
If ActiveWindow.SelectedSheets.Count = 1 Then
'if no sheets selected, select all worksheets
Set oSheets = ActiveWorkbook.Worksheets
Else
'set variable to select sheets
Set oSheets = ActiveWindow.SelectedSheets
End If
'store the current sheet and then rotate through each
'sheet and set the print area
Set curSheet = ActiveSheet
For Each oSheet In oSheets
If oSheet.Type = xlWorksheet Then
'set print area only if a worksheet
oSheet.PageSetup.PrintArea = tempS
End If
Next
'return to the original worksheet
curSheet.Select
MsgBox "All print areas on the selected sheets have " & _
"been set to the same as this sheet."
End Sub
Gord Dibben Excel MVP
>I have several worksheets that have identical formats.
>When I change the print range of 1 worksheet, I typically want to change the
[quoted text clipped - 5 lines]
>Thanks
>Al
Al - 13 Nov 2004 00:52 GMT
That was Great! Thanks.
It worked beautifully.
That was half the battle. Is it possible to also set the page breaks
exactly the same in each workbook?
If this is possible, I will be a hero at work.
Thanks again
Al
> Al
>
[quoted text clipped - 62 lines]
> >Thanks
> >Al
Gord Dibben - 13 Nov 2004 01:58 GMT
Al
Setting Page Breaks can be done with Grouped Sheets.
After setting the print range with Bob's macro.........
Select first sheet then right-click and "Select All Sheets"
Insert Page Breaks on the active sheet and will be done to all sheets.
DO NOT FORGET to right-click and "ungroup sheets" when done.
Gord Dibben Excel MVP
>That was Great! Thanks.
>It worked beautifully.
[quoted text clipped - 75 lines]
>> >Thanks
>> >Al