Vb msgbox with hidden named ranges

  • Hi, I’m new here. I figure I’d get that out of the way right away. I’m also relatively new to the concept of implementing VB into my excel worksheets. I maybe a bit more than a novice but not by much.

    So my issue what I’m trying to attempt, is I have a worksheet with multiple drop down choices, and based on those choices I have named ranges that hide whole rows.

    What I’m looking to do, is have a way that at any given moment, I code run a piece of code that would tell me exactly what sections, or more precisely what named ranges within my sheet are currently being hidden and display that information in the form of a msgbox.

    Like Range_blah blah is hidden.

    If anyone can help me out I’d appreciate it.

  • Thank you. That’s actually the code I’ve been using. It lists off all the hidden rows. I like what this does, but instead of telling me the row numbers of hidden content, I’d like it to tell me which ranges(named ranges) are hidden.

  • Possibly...

        Dim rgName As Object, rg As Range
        For Each rgName In ThisWorkbook.Names
            Set rg = Range(rgName.Value)
            If rg.Rows.EntireRow.Hidden = True Then MsgBox rgName.Name
        Next rgName
    End Sub

    If I've been helpful, let me know. If I haven't, let me know that too. 

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!