• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Hiding blank rows on multipe worksheets

Artisez

Member
I have a work book with 23 worksheets, of those 3 are always hidden, with a possibility or more hidden. I need to hide all the rows that do not contain any information. I have a vba that will hide all the blank rows, but it goes to debug. All of the blank rows do get hidden, but then I get the error. I unhid all the hidden sheets and still get the error. Any help would be appreciated.

1000001702.png


Code:
Sub Hiderow()

    Application.ScreenUpdating = False

    Dim ws As Worksheet

    For Each ws In ThisWorkbook.Worksheets

        With ws

            For i = 8 To 108

            .Rows(i).Hidden = .Cells(i, 8) = ""

            Next

        End With

    Next ws

    Application.ScreenUpdating = True

End Sub
 
Disregard, the problem was caused by 2 sheets protected with no formatting allowed. Set it to allow, formula is working.
 
Back
Top