Hiding rows or columns attached to the value of a cell

L

loeclint

Basically I want to automatically hide a row when the value of one of
it's cells is zero. Thanks a lot.
 
J

JE McGimpsey

If you really want that, put this in the worksheet code module
(right-click the worksheet tab and choose View Code):

Private Sub Worksheet_Calculate()
Dim rRow As Range
Application.EnableEvents = False
For Each rRow In Me.UsedRange.Rows
With rRow
.Hidden = Application.CountIf(.Cells, 0)
End With
Next rRow
Application.EnableEvents = True
End Sub

Every time the sheet calculates, each row will be evaluated for a cell
containing zero. If one is found, the row will be hidden.
 
Top