Macro to HIDE blank rows

  • Thread starter Thread starter JForsyth
  • Start date Start date
J

JForsyth

I have seen a couple of threads on how to create a macro to DELETE blank rows
but this is not what I'm looking for. I need to be able to simply HIDE the
blank rows. Does anyone know how to do this?
 
Try the below

Sub Hideemptyrows()
For lngRow = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If WorksheetFunction.CountBlank(Rows(1)) = Columns.Count _
Then Rows(lngRow).Hidden = True
Next
End Sub

If this post helps click Yes
 
Sub row_hide()

Dim rng As Integer, i As Integer

rng = Cells(Rows.Count, "A").End(xlUp).Row

For i = 1 To rng
Cells(i, "A").Select
x = Application.WorksheetFunction.Count(ActiveCell.EntireRow)
If x = 0 Then ActiveCell.EntireRow.Hidden = True
Next i
End Sub
 
Thanks for writing back! Unfortunately it's not working...when I run it, the
rows don't become hidden...any suggestions?
 
Oops. That was my mistake.Try the below

Sub Hideemptyrows()
For lngRow = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If WorksheetFunction.CountBlank(Rows(lngRow)) = Columns.Count _
Then Rows(lngRow).Hidden = True
Next
End Sub

If this post helps click Yes
 
Thank You!!!! It works perfectly!

Jacob Skaria said:
Oops. That was my mistake.Try the below

Sub Hideemptyrows()
For lngRow = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If WorksheetFunction.CountBlank(Rows(lngRow)) = Columns.Count _
Then Rows(lngRow).Hidden = True
Next
End Sub

If this post helps click Yes
 
Thank you!!! This works perfectly!!!

Jacob Skaria said:
Oops. That was my mistake.Try the below

Sub Hideemptyrows()
For lngRow = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If WorksheetFunction.CountBlank(Rows(lngRow)) = Columns.Count _
Then Rows(lngRow).Hidden = True
Next
End Sub

If this post helps click Yes
 
Back
Top