View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default RowHeight and AutoFit wit Merged Cells

"Howard Kaikow" wrote in message
...
"Howard Kaikow" wrote in message
...
I was wondering whether using a Union, as below, is faster.


Using a sample size of 1 run, Union is much faster, 30 seconds rather than
39 seconds.


Difficult to comment without context of what you are doing overall. I take
it you are processing a lot of cells.

Union is pretty quick with a small number of areas but rapidly becomes
exponentially slower with more. Note it is the number of resulting areas
rather than number of unions that's relevant. It's a little bit faster to
make a multi-area range with an address. Limited to 255 characters or say 16
multcell areas located anywhere on the sheet and $'s trimmed (would need to
recalc the max safe qty in xl2007). All this is of little consequence with
only four areas as you appear to have. Except of course having built the
multi area it's then faster to work with rather than each individual area,
as you have found.

There's a difference in how the range is made with address vs union which
might be of relevance to you (apart from small speed gain). Namely you can
build adjacent multi-areas. So for your purposes you could replace four
MergeCells = True, that relate to adjacent areas, with just one mergecells =
true. If that doesn't make sense I'll post an example.

I can't help but wonder if your current 30 seconds might much less. Guess it
depends on what you are doing.

Regards,
Peter T