Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Excel 2010+ Hide all rows except a table

Excel 2010+ Hide all rows except a table

Excel 2010+ Hide all rows except a table

Hi Guys,

I’m looking for a little help with hiding rows of data in excel. My user wants a VBA userform that has X number of buttons on and when clicked it filters the worksheet so that only certain data is shown. I have this working at the moment. Due to the nature of the data certain sections of the data might increase in size, so where previously dummydata1 might be in range a1:c5, it might be amended to a1:c9 which means my hiding of rows needs amending. The data on the worksheet isn’t in an easy format to manipulate and client doesn’t really want to change the layout if possible. I thought I could put the data in tables which would solve the range changing issues, however I’m not sure if you can hide all rows except a table.

Any help would be appreciated. Sorry for any typos or badly written sentences and for not sharing code, I am using my phone for this plus have been up since 5:30am and it is now past midnight.




RE: Excel 2010+ Hide all rows except a table


I would hope that your table is either a Structured Table or has a Named Range like Database to reference the entire table or has Named Ranges based on Heading Names for each column of data. Short of that you can identify the top-left cell reference with a Named Range, which will “float” as rows are added/deleted above your table, and using the CurrentRegion property, you can define the top row using the Row property and the last row using the Rows.Count.

BTW, I assume that your table is completely isolated from the other data on All sides, by at least one empty row above and below and one empty column to the left and right.


glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Excel 2010+ Hide all rows except a table


Sub HideRowsButTable()
'hide all rows
    ActiveSheet.Cells.EntireRow.Hidden = True
'unhide table
    With [MyTopLeftCell]
        .CurrentRegion.EntireRow.Hidden = False
    End With
End Sub

Sub UnHideAll()
    ActiveSheet.Cells.EntireRow.Hidden = False
End Sub 


glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close