MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Automatic Page Setup


Posted by Sam on June 26, 2001 12:15 PM

I'm trying to automatically perform a page set-up for a new workbook. I recorded a macro while doing the page set-up. This worked fine but when I ran the macro it was very slow. I checked the macro and it gave a fairly lengthy "With" statement. If anyone knows a better and faster way to automatically run a page set-up that would be very helpful.

Thanks,
Sam


Posted by Ben O. on June 26, 2001 12:21 PM

To speed up the macro insert Application.Screenupdating = False at the beginning of the code.

You also only need to include the things you want to change in the With statement. If all you're doing is changing the left and right margins, you can delete every other statement between WITH and END WITH.

-Ben

Posted by RayH on June 26, 2001 12:22 PM

You could save the completed setup as a template or

try placing this at the top of your macro:

Application.ScreenUpdating = False

this at the bottom:

Application.ScreenUpdating = True

Posted by Sam on June 26, 2001 1:36 PM

Thanks

That did speed it up! Thanks for your help!

Sam