Avatar of Zipbang
 asked on

EXCEL VBA not unhiding

It's probably b/c I am tired, but I can't figure out why this piece of VBA code will not unhide the cells.

The cells in question are calculation cells (if,then) that are either a numeric value or nothing ("").  When the cell is nothing ("") they should be hidden, otherwise they should be unhidden.

Sub HideEndorsementRows()

    Dim rRow             As Range
    Dim rRowRange        As Range
    Dim rCell            As Range
    Dim bHide            As Boolean
    Set rRowRange = Intersect(ActiveCell, Range("A1:A17"))

    ActiveWindow.DisplayZeros = False
    Application.ScreenUpdating = False

    For Each rRow In rRowRange.Rows
        bHide = False

        For Each rCell In rRow.Cells

            If Len(rCell.Value) = 0 Then 'check here if cell has a value other than ""
                bHide = True
                Exit For
            End If
        Next rCell
        rRow.EntireRow.Hidden = bHide

    Next rRow

    Application.ScreenUpdating = True

End Sub

Open in new window

Microsoft ApplicationsMicrosoft OfficeMicrosoft Excel

Avatar of undefined
Last Comment

8/22/2022 - Mon
Patrick Matthews

As sample file would be helpful :)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

great, thank you
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.