.PageSetup on multiple sheets in workbook

G

Guest

Due to the slowness encountered using the .PageSetup in Excel, I was
attempting to do a one-shot setup as opposed to doing a setup per page. The
macro code is only setting up the active sheet when multiple sheets are
selected. However, if I do it manually, it sets up all the sheets at once.
Is this a glitch with VBA or is there code to get it to work properly?
 
J

Jim Cone

I found that trying to set pagesetup properties on ganged sheets
sucked up every bit of memory, took a long time and the display
turned white. I quit trying to do that. <g>

Just loop thru the ActiveWindow.SelectedSheets using a For / Next loop
and set the pagesetup properties for each sheet one at a time.
Make sure to turn off the display of pagebreaks on each sheet
before setting any pagesetup properties.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Steve" <[email protected]>
wrote in message
Due to the slowness encountered using the .PageSetup in Excel, I was
attempting to do a one-shot setup as opposed to doing a setup per page. The
macro code is only setting up the active sheet when multiple sheets are
selected. However, if I do it manually, it sets up all the sheets at once.
Is this a glitch with VBA or is there code to get it to work properly?
 
T

Tom Ogilvy

VBA doesn't support operations on grouped sheets for the most part. This
is a workaround posted by KeepItCool Set up a model sheet (the activesheet
for the group), then put this at the end.

Sheets(Array("Sheet1", "Sheet3")).Select
SendKeys "{enter}"
Application.Dialogs(xlDialogPageSetup).Show
 
O

owlnevada

Reading these were helpful to me. An easy way if not done repetitively and
frequently is that if you keep your selected sheets active, you can run the
Page Setup properties one time and it will afftect only the active sheet, but
if you then reselect the Page Setup DB and pick OK, it will set those other
sheets to the same settings. It does run somewhat slow but you can comment
out those lines that you know haven't changed any and it speeds up
considerably.

HTH

owlnevada
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top