View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Josh Sale Josh Sale is offline
external usenet poster
 
Posts: 177
Default Setting PageSetup Properties in Multiple Worksheets

Dave,

Basically that's what I have now (actually I do the PageSetup after I add
and format each worksheet). I'm trying to avoid the time it takes to set a
number of PageSetup properties multiplied by the number of worksheets I need
to set them for.

Thanks.

josh




"Dave Peterson" wrote in message
...
How about just looping through the worksheets...

dim wks as worksheet
for each wks in worksheets(array("sheet1","sheet2"))
with wks.pagesetup
...
end with
next wks

Josh Sale wrote:

Right now my VBA code creates a number of worksheets and then sets a
bunch
of their PageSetup properties.

Because PageSetup can be so slow, I would like to set all of the
properties
at once. I tried:

With Sheets(Array("Sheet2", "Sheet1")).PageSetup
.LeftHeader = "foo"
...
End With

But I get a run-time error on the With statement (438 Object doesn't
support
this property or method).

Is there some other way to accomplish this or to dynamically (and
temporarily) define what the default PageSetup properties should be for
newly added worksheets?

TIA,

josh


--

Dave Peterson