MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Using a macro to hide empty rows


Posted by James on August 19, 2000 5:43 PM

Hi, I would like to create some sort of macro to hide rows that are empty. I've got a sheet with about 70 rows in it, some are empty and some are not, and instead of scolling all around this sheet, I would like to assign a macro to a button that can recognize if a row is empty and then hide it.
Thanks for any help.


Posted by James on August 20, 0100 1:03 PM

Thank You

Thank you Celia, that works exactly like I wanted it to do.

Posted by Celia on August 19, 0100 8:10 PM


James

Sub HideBlankRows()
Dim rng As Range, cell As Range
Set rng = Application.Intersect(ActiveSheet.UsedRange, Range("A:A"))
For Each cell In rng
If Application.CountA(cell.EntireRow) = 0 Then cell.EntireRow.Hidden = True
Next
End Sub

Celia