Automatically hide a row if it is empty

  • Thread starter Thread starter Vil
  • Start date Start date
V

Vil

Hi,

I would like Excel to hide a couple of rows if a formula input in the cells
of that row results in "" and show them if the formula shows numbers. Has
anyone worked out how to do it?

Thanks
Steve
 
Hi.
Paste the following code in the sheet module. It's assuming to check
formulae from cells A5:A10.

Private Sub Worksheet_Calculate()
Application.EnableEvents = False
For i = 5 To 10
If Cells(i, 1) = "" And Cells(i, 1).HasFormula Then
Rows(i).Hidden = True
Else
Rows(i).Hidden = False
End If
Next i
Application.EnableEvents = True
End Sub

HTH
Daniel
 
Back
Top