View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Slow Performance Hiding Rows

Tom,
I agree, DisplayPageBreaks does belong above the loop.
Regards,
Jim Cone


"Tom Ogilvy" wrote in message
...
Might want to move the DisplayPageBreaks command up above the loop - good
suggestion.
Regards,
Tom Ogilvy



"Jim Cone" wrote in message
...
Brent,

This is a little simpler and should run much faster.
It works from the bottom up, turns off the display
of page breaks and doesn't select anything.

'-----------------------
Public Sub Hide_Rows(ByRef rng As Excel.Range)
Dim r As Long

Application.ScreenUpdating = False
For r = rng.Rows.Count To 1 Step -1
Application.StatusBar = "Row " & r
ActiveSheet.DisplayPageBreaks = False
If Len(rng(r).Value) = 0 Or rng(r).Value = "None" Then
rng(r).EntireRow.Hidden = True
Else
rng(r).EntireRow.Hidden = False
End If
Next r
Set rng = Nothing
Application.StatusBar = False
Application.ScreenUpdating = True
End Sub
'------------------------

Jim Cone
San Francisco, USA