Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Slow performance after print preview | Excel Discussion (Misc queries) | |||
Save as PDF not same size as Print and Print Preview in Excel | Excel Discussion (Misc queries) | |||
First page of Excel sheerepeats in print layout or print preview | Excel Discussion (Misc queries) | |||
Excel cell looks good in print preview but doesn't print??? | Excel Discussion (Misc queries) | |||
Macro buttons tiled after print / print preview | Excel Programming |