View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
bill_morgan bill_morgan is offline
external usenet poster
 
Posts: 29
Default VBA to Select All Visible Sheets

Thanks, Gary. I thought this might solve the problem, but on activating one
sheet after selecting all of them, the change page setting code only changed
the settings on that one activated sheet, even though all sheets were
selected - it did not change settings for all of the selected sheets, like it
would if you made the change manually (interactively).



"Gary Keramidas" wrote:

this would select all of the sheets

Worksheets.Select


--


Gary


"bill_morgan" wrote in message
...
Hi ....

I need to write VBA code that will select all visible sheets in the
workbook, and then change the page setup settings. Is there a simple VBA
command to select all visible sheets or do I need to use a variation of the
following:

Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5")).Select

- in which case I will need to loop through the workbook names and build
the string since I don't know the sheet names. There are approx 40 sheets in
each file.

Thanks for your assistance ....