Hi Everyone,
I have this macro that is working perfectly, the only problem is that it takes very long time when a lot of rows are empty. I would like someone to help me modify it to make it faster.
I have a report with information form A3:P103, when a cell from column B3 is empty the entire row is hidden, then it prints the report, and unhide all rows again.
Here it is:
Sub Hide_rows_2()
Dim myCell As Range
Dim myRng As Range
With Worksheets("WORK HOURS REPORT")
Set myRng = .Range("B3", .Cells(.Rows.Count, "B").End(xlUp))
For Each myCell In myRng.Cells
If Trim(myCell.Value) = "" Then
myCell.EntireRow.Hidden = True
End If
Next myCell
.PrintOut
.UsedRange.Rows.Hidden = False
End With
End Sub
Thank you!
Andina4e
I have this macro that is working perfectly, the only problem is that it takes very long time when a lot of rows are empty. I would like someone to help me modify it to make it faster.
I have a report with information form A3:P103, when a cell from column B3 is empty the entire row is hidden, then it prints the report, and unhide all rows again.
Here it is:
Sub Hide_rows_2()
Dim myCell As Range
Dim myRng As Range
With Worksheets("WORK HOURS REPORT")
Set myRng = .Range("B3", .Cells(.Rows.Count, "B").End(xlUp))
For Each myCell In myRng.Cells
If Trim(myCell.Value) = "" Then
myCell.EntireRow.Hidden = True
End If
Next myCell
.PrintOut
.UsedRange.Rows.Hidden = False
End With
End Sub
Thank you!
Andina4e