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 Hide rows if formula result is zero

Try this on a copy of your workbook

Select the cells and run this

Sub DeleteRows()
Dim r As Long
With Selection
For r = .Cells.Count To 1 Step -1
If .Cells(r, 2).Value = 0 And .Cells(r, 3).Value = 0 Then
.Cells(r, 2).EntireRow.Hidden = True
End If
Next
End With
End Sub



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



"John" wrote in message ...
My spreadsheet layout is as follows:

A B C
Apples 50 20
Oranges 0 0
Bananas 15 0

I need excel to hide the rows when the results of the formulas in both
column B and C are zero. Oranges would be hidden, bananas would not. If the
cell in B or C is empty, I don't want it hidden. All formulas in cells I
want hidden start with =sumif. I am using Excel 2000. Thanks for the help.