View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Bottlenecks in an Excel VBA application

"Jac Tremblay" skrev i melding
...
Hi Harald,

What you say is right and I am exactly that person. But I am not an MVP

nor
an expert and I thought that a tool could speed up my work.


Hi again Jack

Apologies <g. I don't know of any place where those are collected. These
are the things I look for first, maybe what you already do:
- Calculation turned off when entering into cells ?
- Screenupdating turned off while code does things to sheets ?
- Any unneeded Select or Activate actions ? (Do a Search for those words and
see if there are any and what they do if so)
- Any undeclared or lousy declared memory eating variables or collections ?
- Efficient object coding ? ("Set Ws = ThisWorkbook.Sheets(1)" instead of
looking for and activating Workbook and Sheet1 again and again by code)
- Any meaningless tests ? (Like all cells in a range instead of all cells
with numeric constants ?)
- Any inefficient tests ? (Test for the least likely first. Say we want to
find all swedish male persons in the world by testing everybody. This
if male then
if swedish then
here the inner test runs billions of times
but this
if swedish then
if male then
here the inner test runs only 9 million times)

Also, for a start I place MsgBoxes all over the code to see which parts that
runs fast and which that I have to wait for.

I can't imagine how a program could spot these things. But lots of clever
people are in here, so if someone can do it, it would be fantastic.

Best wishes Harald