I am running a macro to hide all rows that have a value of "0" and print the rest. So it does just that very well however it hides the last row and I can't figure out why. So for example I have 10 rows with data, only 9 rows print. Please help because I can't figure it out.
Sub Button2_Click()
Sheet4.Unprotect Password:="1"
Dim rw As Long
Dim rng As Range
Dim cell As Range
Application.ScreenUpdating = False
Set rng = Sheets("Test Reg UC").Range("b11:b63")
With rng.Columns(1)
For Each cell In rng
If Application.WorksheetFunction.CountA( _
.Parent.Cells(cell.Row, 1).Range("b2")) = 0 Then _
.Parent.Rows(cell.Row).Hidden = True
Next cell
.Parent.PrintOut
.EntireRow.Hidden = False
End With
Application.ScreenUpdating = True
Sheet4.Protect Password:="1"
End Sub
Any additional questions I would be more then happy to clarify anything.
Bookmarks