if cell = 0 then hide the row

  • Thread starter Thread starter JurgenBrea
  • Start date Start date
J

JurgenBrea

I would like to have a small macro which would check the value of a cell, if
the value is zero then hide the row. Can anyone help me out with that at
all?
 
Hi
try the following macro:
Sub hide_rows()
Dim lastrow As Long
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
For row_index = lastrow - 1 To 1 Step -1
If Cells(row_index, 1).Value=0 then
rows(row_index).hidden=true
End If
Next
Application.ScreenUpdating = True
End Sub
 
Back
Top