LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Why does macro speed slow after Excel Print or Print Preview?

The below macro, which I have left literally as coded, runs very quickly
from Excel -- until, in Excel, I do either a print or print preview in
native Excel, not VBA. After which, the macro, when next invoked, runs
about 10 times slower which makes it performance unacceptable. If I close
and reopen the spreadsheet, however, it seems to reset the internal
environment and the macro once again runs nicely. Until the next print or
print preview.

The macro is intended to display only selected portions of a large table
spanning about 12000 rows. The print range, however, is set to run from the
top of the table to just one past the end of the table, or row 12001, in
order to include all lines currently unhidden. Excel takes a little time
working through this formatting before displaying. And I wonder if this is
leaving Excel slightly corrupted. I don't see how the issue could be the
macro, but I have included below for reference.

Version is Excel 2002. Any thoughts? Thanks in advance. Larry.

Private Sub cmdPlusOne_Click()
Dim i, curr_level, row As Integer, c As String
Worksheets("FOCUS").Activate
c = ActiveCell.Address
row = ActiveCell.row
With Range("A" & row)
curr_level = .Offset(0, 0)
For i = 1 To 20000
If (.Offset(i, 0) = Null) Or (.Offset(i, 0) <= curr_level) Then
Exit For
ElseIf .Offset(i, 0) = curr_level + 1 Then
Rows("" & (row + i) & ":" & (row + i) & "").Select
Selection.EntireRow.Hidden = False
End If
Next i
Range(c).Select
End With
End Sub


(Just as further FYI, the table being processed by the macro above is
actually an outline. Level refers to the outline indent level of the current
active cell. The macro is intended to then unhide any entries one level
further down in the outline.)


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slow performance after print preview SV[_2_] Excel Discussion (Misc queries) 1 October 30th 09 12:24 PM
Save as PDF not same size as Print and Print Preview in Excel Jack_Sprat Excel Discussion (Misc queries) 4 April 13th 09 06:38 PM
First page of Excel sheerepeats in print layout or print preview philfrotonda Excel Discussion (Misc queries) 1 July 12th 07 09:28 PM
Excel cell looks good in print preview but doesn't print??? Jack Gathright Excel Discussion (Misc queries) 1 September 13th 05 12:38 PM
Macro buttons tiled after print / print preview Eddie Chan Excel Programming 2 January 1st 05 02:50 PM


All times are GMT +1. The time now is 06:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"