Hide rows when quantity is zero
Sub Tester2()
Dim rng As Range, rng1 As Range, cell As Range
Set rng = Range(Cells(2, 1), Cells(2, 1).End(xlDown))
For Each cell In rng
If Application.Sum(cell.Offset(0, 1).Resize(1, 2)) = 0 Then
If rng1 Is Nothing Then
Set rng1 = cell
Else
Set rng1 = Union(rng1, cell)
End If
End If
Next
If Not rng1 Is Nothing Then
rng1.EntireRow.Hidden = True
End If
End Sub
--
Regards,
Tom Ogilvy
"Michael" wrote in message
...
Hi, I have a spreadsheet which calculates a (long) order list. I'm looking
for a way to hide the row when the calculated quantity is zero.
Order item Station A Station B
100-123 1 3
100-124 1 1
100-125 0 0
100-126 3 3
In this example I want to be able to hide the row with 100-125 and all
zero
quantities (while maintaining the formulas in that row)
Michael
|