Thread: speed up macros
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Flanagan Bob Flanagan is offline
external usenet poster
 
Posts: 340
Default speed up macros

Dave, the trick is to only change the pagesetup properties that need
changing. For example:

if .LeftHeader < "&8&F" then .LeftHeader = "&8&F"

This will make the code fly as checking a property is lightning fast, and
you only change the ones you need to change.

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


"Dave B" wrote in message
...
Is there any way to speed up procedures that change Print Setup

attributes?
The entire procedure is:

Sub DavesPageSetup()
With ActiveSheet.PageSetup
.LeftHeader = "&8&F"
'...15 total attributes
End With
End Sub

That's it, and yet it still takes 30+ seconds. My other macros are fast

but
whenever I do something that involves the printer it's about as fast as a
crippled turtle. Anyone know how to make it run faster? (I have an HP

842C
Deskjet if that helps.) Thanks.