MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Macro to format - view & page setup


Posted by Shanna on December 29, 2001 12:10 PM

I recorded a macro that set margins, added a footer and set view to 75%. I then plugged this code into a macro to do this on every sheet (10 sheets). It takes forever. Is there any way to streamline such a macro? Thanks :-)


Posted by Jacob on December 29, 2001 1:39 PM

Hi

Since you recorded the macro there may be things it is doing that you dont need. Make sure you delete everthing that is not needed. Then try to array all 10 sheets and run the macro once it may be faster than doing a loop.

Hope this helps

Jacob

Posted by Shanna on December 29, 2001 2:57 PM

Thanks, Jacob. Do I need to know the sames of the sheets and/or how many there are. I'd like to use this same macro for different workbooks. Can you give me an example of what this array would look like. Thanks :-)


Posted by Jacob on December 29, 2001 4:02 PM

Either Or

Hi

You can do it either way.

If you know the names:

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

if not:

Sheets(Array(Sheets(1).Name, Sheets(2).Name, Sheets(5).Name)).Select


Etc

Jacob