Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Detecting Hidden Rows.

Detecting Hidden Rows

by Allen Wyatt
(last updated November 12, 2016)

6

Jesse has a large worksheet that may contain hidden rows. He wonders if there is a way to find out if there are hidden rows in the worksheet other than by looking down the many rows to see what's missing. If he unhides all the hidden rows, he still won't be able to tell what, if any, rows may have been hidden.

One way you can identify hidden rows is to follow these general steps:

  1. In a column that has nothing in it, select all the cells that will cover the area you want to check. (You can select the entire column, if you desire, but that may be overkill.)
  2. Press Alt+; (that's a semicolon). Excel selects only the unhidden cells in the selected range.
  3. Press X (or some other viewable character) and press Ctrl+Enter. This puts the character (X) into all the visible cells.

Unhide all the rows, and you'll be able to easily see which cells in that column don't have the character (X) in them. These are the rows that were previously hidden. You could also, if desired, use the same general approach, but after step 2 (instead of step 3) you could apply some pattern or color to the cells. Once you unhide all the rows, those cells without any pattern or color are the ones that were previously in hidden rows.

If you don't want to unhide rows at all, perhaps the best way to find out the information is to use a macro. The following simple macro steps through the first 1,000 rows of a worksheet and then lists, in a message box, the rows that are hidden.

Sub ShowRows()
    Dim rng As Range
    Dim c As Range
    Dim sTemp As String

    Set rng = Range("A1:A1000")
    sTemp = ""

    For Each c in rng
        If c.EntireRow.Hidden Then
            sTemp = sTemp & "Row " & c.Row & vbCrLf
        End If
    Next c

    If sTemp > "" Then
        sTemp = "The following rows are hidden:" & vbCrLf & _
          vbCrLf & sTemp
        MsgBox sTemp
    Else
        MsgBox "There are no hidden rows"
    End If
End Sub

Note that the heart of the macro—where it determines whether a row is hidden or not—is in checking the Hidden property of the EntireRow object. If this property is True, then the row is hidden.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12217) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Detecting Hidden Rows.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Selecting a Line of Text

Many word processing programs include commands that allow you to select a line of text. Word doesn't, but you can use the ...

Discover More

Inconsistent Prompting to Save Normal Template Changes

You can configure Word to notify you when it is about to save updates to the Normal template. There may be some confusion, ...

Discover More

Making Fast Work of Uploading Files to Drive

What's the fastest way to get files into your Drive space? Why, dragging and dropping, of course! You'll find the complete ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Adjusting Row Height for Your Text

Want Excel to automatically adjust the height of a worksheet row when it wraps text within the cell? It's easy to do, relying ...

Discover More

Increasing Row Height for Printing

You may have a need to increase the height of the rows in your worksheet to "spread out" the data when it is printed. This ...

Discover More

Adjusting to a Maximum Row Height

Need to check the height of all the rows in a worksheet and then adjust them if a particular criterion is met? This tip ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 8 - 2?

2016-12-14 16:10:41

Don

In the first method, you can skip step 2. Step 3 will only affect the unhidden cells anyway.


2016-11-14 09:21:59

Ken G

Sharon, I hope your suggestion that hiding rows and columns is dangerous was for specific scenario. There certainly are times when hiding them can be very useful...and SAFE.


2016-11-13 09:08:21

Selwyn

Depending on what you want to do with the Revealed Hidden Rows, an alternative would be to change the Hidden State of all rows so that just the Hidden Rows are now visible and can be dealt with. Run the Sub again to set back to original state.

For Each c in rng
c.EntireRow.Hidden = Not
c.EntireRow.Hidden
Next c


2016-11-12 12:15:54

David Gray

This is one of those "why didn't I already think of that?" tips, and it could be easily adapted to find hidden columns, which occur fare more often in my worksheets than do hidden columns, with the exception of filtered worksheets, which provide their own mechanism for identifying hidden rows.


2016-11-12 11:47:15

Sharon Pickthorne

Thanks for this. Funny - I was teaching just the other day about the dangers of HIDING rows or columns. I suggest using GROUP instead - then you have those nice + and - signs and the ability to use the levels. Much safer than hiding.


2016-11-12 08:02:36

Frank Panipinto

If you want to have a quick visual indicator as to which rows are hidden, just add the following line after "sTemp = sTemp & "Row " & c.Row & vbCrLf"

c.EntireRow.Interior.ColorIndex = 28

This will apply a background color to instantly see all the hidden rows once you unhide them. Just change the color number to suit your taste.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.