View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Hiding Rows with Formulas

Your cells are not empty (formulas) that's why it is not working
You can loop and look for ""

Sub Example2()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 9
EndRow = 1000
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "B").Value) Then
'Do nothing, This avoid a error if there is a error in the cell

ElseIf .Cells(Lrow, "B").Value = "" Then .Rows(Lrow).EntireRow.Hidden = True

End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Ruan" wrote in message ...
Hello

I have an IF statement in Range("B9:B1000"), which either displays a value
or a blank cell. How do I hide the rows, if the result in this range is a
blank cell? The below formula doesn't work.

Sub HideRows()

With Range("B9:B1000")
.EntireRow.Hidden = False
.SpecialCells(xlCellTypeBlanks).EntireRow.Hidden = True
End With
Range("B9").Select
End Sub

Thanks
Ruan