ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using macros to condense a template (https://www.excelbanter.com/excel-programming/404838-using-macros-condense-template.html)

[email protected]

Using macros to condense a template
 
I had a friend that used to do this and damn it if I can find that
file. Anyway, does anyone know how to condense a spreadsheet using a
macro that can select and hide only the rows that are empty.

ilia

Using macros to condense a template
 
On Jan 23, 12:38*am, wrote:
I had a friend that used to do this and damn it if I can find that
file. *Anyway, does anyone know how to condense a spreadsheet using a
macro that can select and hide only the rows that are empty.


Try this code.

Public Sub hideEmpty()
Dim rng As Excel.Range
Dim rngCell As Excel.Range

With ActiveSheet
Set rng = Intersect(.UsedRange, .Range("A:A"))
End With

For Each rngCell In rng
If Application.WorksheetFunction.CountA(rngCell.Entir eRow) = 0
Then
rngCell.EntireRow.RowHeight = 0
End If
Next rngCell
End Sub


All times are GMT +1. The time now is 10:24 AM.

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