ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Automatically hide a row if it is empty (https://www.excelbanter.com/excel-discussion-misc-queries/210850-automatically-hide-row-if-empty.html)

Vil

Automatically hide a row if it is empty
 
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



Daniel.C[_2_]

Automatically hide a row if it is empty
 
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

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





All times are GMT +1. The time now is 03:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com