Link to home
Start Free TrialLog in
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

Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

As sample file would be helpful :)
Avatar of byundt
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zipbang


great, thank you