Hide Zero Rows - But Not Blank Rows
Hello,
Need to hide rows that a certain range sums to zero in, which the code below
does.
What it also does is hide any blank rows as well, which does not work for
the intended purpose.
Tried numerous attempts at [paraphrasing] ....
If row = 0 hide AND If row = "" do not hide
.... To no avail.
Thanx in advance to anyone who can solve this.
- Mike
Sub HideRows()
ActiveWindow.DisplayZeros = True
On Error Resume Next
With Range("e13:i600")
..EntireRow.Hidden = False
For i = 1 To .Rows.Count
If WorksheetFunction.Sum(.Rows(i)) = 0 Then
..Rows(i).EntireRow.Hidden = True
End If
Next i
End With
On Error Resume Next
With Range("e13:i600")
..EntireRow.Hidden = False
For i = 1 To .Rows.Count
If WorksheetFunction.Sum(.Rows(i)) = "" Then
..Rows(i).EntireRow.Hidden = False
End If
Next i
End With
End Sub
|