MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Hiding rows...


Posted by Matt Stone on June 12, 2001 9:39 AM

Greetings all,
I was wondering if there was a simple (read
automated) way to hide a row when the value of column
D is 0 (not blank, zero)?

If anyone would like the sheet I'm using, I'd be more
than willing to E-mail it...

Any help (other than RTFM) is appreciated...

Thanks,
Matt


Posted by Ron on June 12, 2001 11:06 AM

Posted by Joe Was on June 12, 2001 11:51 AM

The VB code below will hide all rows in column A.
If a row contains 0. It runs from a option Ctrl-+key now and was tested with values in column 1 and random values in its rows!

Sub MyHide()
'This "Hides" any Row in Column(A) that =0.
'By J.S. Was, 6-12-2001.
Dim i
For i = 1 To 10
With Intersect(Columns(1), ActiveSheet.UsedRange)
Rows(i).Select
If .Rows(i).Value = 0 Then
Selection.EntireRow.Hidden = True
End If
End With
Next
End Sub

Posted by Matt Stone on June 16, 2001 7:45 PM

Excellent! Works perfectly!
I really appreciate the help.