View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Row Height -- Slows VBA

Why don't you do something like this

Sub Test()
Dim myRange As Range
Set myRange = Rows("1:10")

myRange.EntireRow.Hidden = True

End Sub

instead of doing it row by row.
--
HTH,
Barb Reinhardt

If this post was helpful to you, please click YES below.



" wrote:

Row heights are static and defined in Cells (FA1:FA100). An hyperlink
event hides Rows (1:90), thereby making their row height equal to
zero. A second hyperlink event unhides Rows (1:90). VBA code loops
through the values in Cells (FA1:F100) to define the appropriate row
height for each row.

This works fine. It works quickly, instantaneously.

Then, however, I'll do either a print or a print preview on the
worksheet. The print and print preview work fine.

Subsequently, however, the time it takes for the code associated with
either hyperlink noticeably increases. Something associated with the
print or print preview alters the behavior of the code that re-
establishes the row height for each row.

I trapped the code and manually processed through the code. With each
loop, one through one hundred, the row height for each row set
properly, but with a brief hour glass display on each pass. Code that
once passed through each row height setting instantaneously now took a
fraction of a second. The cumulative effect of this, over one hundred
row height settings, is quite significant, perhaps fifteen seconds.

The screen update and the enable events are set to false as the code
passes through the loop. The calculation is set to xlManual. The print
setting crams one hundred rows of information into one page. However,
the same problems exist when I remove the "fit to one page" parameter.

Have any of you encountered this? I'm using Excel 2003.

Thank you for your time and consideration.

Michael