Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Optimizing VBA Code

Status
Not open for further replies.

ebrooks54

IS-IT--Management
Dec 4, 2002
54
US
Is there any documentation, white papers, guidelines, or discussions on code optimization?

I've been working hard to develop a series of Excel and Word Macros to generate an order form. In the almost final step, I have created a Word macro that steps through rows of a table that were populated via a mailmerge from Excel.

The Macro essentially formats each row depending on a 'tag' field. Depending on the value of the tag, any particular row could have the cells joined, a header style applied, and/or possibly have the row shaded.

In executing the macro, I am finding that even on a 2Ghz computer, if the table is several thousand rows long, the time to complete the task can be measured in hours.

Other than turning off screen updating, what else can you do to make sure your code is as efficient as possible?
 
Take a look in the FAQ area of this forum.
 
See Skip's FAQ - How Can I Make My Code Run Faster?
faq707-4105.

It may not completely solve the issue of dealing with "thousands of rows", but it may give you a couple of ideas.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top