Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. 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: Hiding a Huge Number of Rows.
by Allen Wyatt
(last updated April 23, 2022)
Julia would like to hide all the rows in a worksheet except rows 1-30. She is looking for the fastest, easiest way to do this.
If you don't have to do the hiding too often, the easiest method is the following, provided there is something in every cell of column A:
If you don't have data in all the cells of column A, then the following variation is probably the fastest method:
Here's another quick method that can be used:
If you need to hide rows like this quite often, you could use the macro recorder to record any of the above techniques, or you could use a more flexible macro, like this one:
Sub HideRows() Dim r As Variant On Error GoTo Canceled r = InputBox("Rows to Hide:") Rows(r).EntireRow.Hidden = True Canceled: End Sub
The only caveat is that you need to remember to include a colon in the rows you specify for the macro. Thus, if you wanted to hide rows 31 through 543, you would enter 31:543.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12125) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, Excel in Microsoft 365, and 2021. You can find a version of this tip for the older menu interface of Excel here: Hiding a Huge Number of Rows.
Save Time and Supercharge Excel! Automate virtually any routine task and save yourself hours, days, maybe even weeks. Then, learn how to make Excel do things you thought were simply impossible! Mastering advanced Excel macros has never been easier. Check out Excel 2010 VBA and Macros today!
Want to set the width and height of a row and column by specifying a number of inches? It's not quite as straightforward ...Discover More
Adjusting the height of a row or range of rows is relatively easy in Excel. How do you adjust the height of those same ...Discover More
Want Excel to automatically adjust the height of a worksheet row when it wraps text within the cell? It's easy to do, ...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.