conditional hiding of rows

  • Thread starter Thread starter Murtaza Jafferjee
  • Start date Start date
M

Murtaza Jafferjee

Is there a way to hide a row in excel subject to a particular condition. In
a cell on a row, if a particular condition is satisfied then that row has to
be hidden.

Any suggestions would be appreciated.

Murtaza
 
Hi
try something like the following:
Sub hide_rows()
Dim RowNdx As Long
Dim LastRow As Long

LastRow = ActiveSheet.Cells(Rows.Count, "D").End(xlUp).row
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "D").Value = 0 Then
Rows(RowNdx).hidden = True
End If
Next RowNdx
End Sub

hides all rows with a zero in column D
 
Try the Data > Filter > AutoFilter menu option.
That's exactly what it does.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top