View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones[_2_] Norman Jones[_2_] is offline
external usenet poster
 
Posts: 421
Default Hiding Rows-Macro or Autofilter

Hi DJ,

And better still might be:

'================
Private Sub CommandButton1_Click()
Dim Rng As Range
Dim rCell As Range
Dim CalcMode As Long
Dim ViewMode As Long

Set Rng = Me.Range("E63", Range("E102").End(xlUp))

On Error GoTo XIT
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView
Me.DisplayPageBreaks = False


For Each rCell In Rng.Cells
With rCell
rCell.EntireRow.Hidden = .Value = 0
End With
Next rCell

XIT:
With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With

ActiveWindow.View = ViewMode

End Sub
'<<================



---
Regards.
Norman