ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Page set-up when selecting multiple sheets (https://www.excelbanter.com/excel-programming/283660-page-set-up-when-selecting-multiple-sheets.html)

Jean-Marc[_3_]

Page set-up when selecting multiple sheets
 
Hello there,

Having problems when writing macro and wishing to set-up a
number of sheets for print in the same format.

The following statement only returns the appropriate set-
up for the first sheet, in the example below, the
Finalised Sheet.

Sheets(Array
("Finalised", "Swanley", "Plant", "STRTU")).Select
With ActiveSheet.PageSetup


Have I discovered a bug or is there a fix ?
Thanks in advance,
Jean-Marc


Vasant Nanavati

Page set-up when selecting multiple sheets
 
Unfortunately, there is no good way to do a multiple PageSetup using VBA
without using a loop, unless you want to use the dreaded SendKeys to
simulate keystrokes.

--

Vasant

"Jean-Marc" wrote in message
...
Hello there,

Having problems when writing macro and wishing to set-up a
number of sheets for print in the same format.

The following statement only returns the appropriate set-
up for the first sheet, in the example below, the
Finalised Sheet.

Sheets(Array
("Finalised", "Swanley", "Plant", "STRTU")).Select
With ActiveSheet.PageSetup


Have I discovered a bug or is there a fix ?
Thanks in advance,
Jean-Marc




Kurt Mayer

Page set-up when selecting multiple sheets
 
Jean-Marc,

You'll have to use the ActiveWindow property of the Excel.Application class to iterate through the multiple sheet selection (effectively a "group edit") you've set up. Here's how you might do that:

dim wks as Worksheet

Sheets(Array
("Finalised", "Swanley", "Plant", "STRTU")).Select

for each wks in ActiveWindow.SelectedSheets
with wks.PageSetup


All times are GMT +1. The time now is 08:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com