Hiding rows or columns attached to the value of a cell

  • Thread starter Thread starter loeclint
  • Start date Start date
L

loeclint

Basically I want to automatically hide a row when the value of one of
it's cells is zero. Thanks a lot.
 
have you though of the implications of this? this means in other words
that if the value is fixed and not from a formula than even if you use
the menus to unhide the row, it will automatically hide again once it
is un hidden ... ?

if this is really what you wish to do and have thought the thing out
right i might have a solution.

Alexandre
 
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.
 
JE McGimpsey,
he will have to add a little something to specify a column to evaluate
;)
 
Back
Top