Article ID: 124934
Article Last Modified on 8/15/2005
126313 XL5: Macro Doesn't Function on Multiple Sheets in Group Mode
Sub ChangePageSetup()
' Dimension variable x as Object type
Dim x As Object
' Group select Sheet1, Sheet2, and Sheet3 worksheets
' Note that there are other methods for selecting multiple sheets
Sheets(Array("sheet1", "sheet2", "sheet3")).Select
' Change page setup options for sheet
For Each x In ActiveWindow.SelectedSheets
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(2)
.RightMargin = Application.InchesToPoints(2)
.Orientation = xlLandscape
End With
Next x
End Sub
Microsoft provides examples of Visual Basic procedures for illustration
only, without warranty either expressed or implied, including but not
limited to the implied warranties of merchantability and/or fitness for a
particular purpose. This Visual Basic procedure is provided 'as is' and
Microsoft does not guarantee that it can be used in all situations.
Microsoft does not support modifications of this procedure to suit customer
requirements for a particular purpose.
Additional query words: 5.00c wrong page setup improper xl
Keywords: KB124934