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.
by Allen Wyatt
(last updated June 21, 2018)
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:
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.
Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!
Excel automatically formats subtotals for you. But what if you want to change the default to something more suitable for ...Discover More
Need to hide a large number of rows? It's easy to do if you combine a few keyboard shortcuts. Here are several techniques ...Discover More
If you have some cells merged in a worksheet, and you wrap text within that merged cell, Excel won't automatically resize ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.