View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
chris[_4_] chris[_4_] is offline
external usenet poster
 
Posts: 7
Default Need for performance boost

Thanks for the suggestions, Bill. I'll surely give them a try.

(Wild Bill) wrote in message ...
A couple of quick observations:

Always use Option Explicit, regardless of the speed issue. I can't tell
if y (and especially x) are integers or longs and they should be one of
the two. Maybe you used public variables, but I can't see that. The
point is to use longs and ints where suitable, not variants (or
especially doubles) unless they're useful. You do math on x, and loop
on x and y, and the types really matter.

You first indicated 400 to 2000 cells. The comments suggest 64 million
loop trips - 8216*8216. If so, consider if that's the real issue (not
that optimizing the code is still not a big payoff). When there really
are that many calculations and/or cells, and the final fully optimized
code still takes quite a while just because it must, when all is said
and done I would at least give visual comfort through the Status bar as
to progress (of which I have been told, that in moderation, is not
costly in execution time). Perhaps bang on the status bar every 1,000
trips through the outer loop, if this is the case. (It's also helpful
during development to quickly see if your optimizations are effective.)
Of course, you could think about a progress meter too.

That said, your code looks good. I can see clear cases of where you've
taken trouble to tweak speed. One possible additional tweak is to not
do each intpos if only one is possible. It would mean messy if
statements but if performance matters and it's appropriate, try it.
Another might be to work on strings instead of ranges. I don't even
know what happens when using Left or Mid on a range but I wouldn't
imagine them to run better than using a string. (Again, I'm guessing,
that your variables beginning with rng are Range as opposed to String)

By the way, if your application is German, I'm impressed with your
ambition to work multilingually. Your English usage is flawless, at any
rate :)