Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default All pages to open in page break mode

If you want to select the sheets to use, you can do the following. I
would avoid, if possible, using the names of your sheets in the code,
because if the sheet names change, you then have to change your code.


Option Explicit

Sub SetPageSetup()
Dim wks As Worksheet
Dim wksCurrentSheet As Worksheet

Set wksCurrentSheet = ActiveSheet

For Each wks In ActiveWindow.SelectedSheets
With wks
.Select
ActiveWindow.View = xlPageBreakPreview
With .PageSetup
.PrintArea = "A1:L43"
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
End With
Next wks


wksCurrentSheet.Select
End Sub


Mark


J.W. Aldridge wrote:
Everything went fine. Except one variable....

Sheets 2 to 6.
Sheet names may actually vary.
Any way to change that line to a range instead?
sheet range (sheetx:sheety)



Sub SetPageSetup()
Dim i As Long
Dim wksCurrentSheet

Set wksCurrentSheet = ActiveSheet

For i = 2 To 6
With Worksheets(i)
.Select
ActiveWindow.View = xlPageBreakPreview
With .PageSetup
.PrintArea = "A1:L43"
.Orientation = xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
End With
Next i

wksCurrentSheet.Select
End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 Page Break Adjustments causes a page break each cell BKaufman Excel Worksheet Functions 2 September 10th 10 05:02 AM
how do I remove dotted page break lines from my workbook pages? marcusaurelius Excel Discussion (Misc queries) 7 August 27th 07 11:44 AM
Excel 2K- Is Page break view limited to 16 pages? Martin Folley Excel Discussion (Misc queries) 1 September 13th 06 02:10 PM
Start and Open in Page Break PreView Sue Hughes Excel Programming 1 November 10th 05 08:44 PM
slow page-break mode Excel Discussion (Misc queries) 0 January 19th 05 04:02 PM


All times are GMT +1. The time now is 04:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"