Using macros to condense a template

  • Thread starter Thread starter cpasearches
  • Start date Start date
C

cpasearches

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.
 
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.EntireRow) = 0
Then
rngCell.EntireRow.RowHeight = 0
End If
Next rngCell
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top