View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Setting PageSetup Properties in Multiple Worksheets

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