troubleshooting Question

EXCEL VBA not unhiding

Avatar of Zipbang
Zipbang asked on
Microsoft OfficeMicrosoft ExcelMicrosoft Applications
3 Comments1 Solution509 ViewsLast Modified:
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
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros