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.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12125) 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: Hiding a Huge Number of 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!
Changing the default row height used for a worksheet is relatively easy, as long as you don't mind the row height never ...
Discover MoreWhen you have text wrap turned on in a cell, Excel expands the height of the row as you add more text to the cell. When ...
Discover MoreExcel automatically formats subtotals for you. But what if you want to change the default to something more suitable for ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2020-09-02 10:36:08
J. Woolley
@Phil W
Your suggestion is easy to do, but it will not be saved when the workbook is closed. You could put the following VBA in the applicable sheet's document module (for example, in code for the Sheet1 object):
Private Sub Worksheet_Activate()
Me.ScrollArea = "A1:W30"
End Sub
2020-09-01 06:51:31
Phil W
If you just want to limit the user to a specific range of cells, Instead of hiding a large number of rows or columns you can use Excel's Scroll Area property.
For example, suppose you want to limit the scroll area to A1: W30, do the following:
1. Click on the Developer tab - If it is not visible, click on File/Options/Customize Ribbon and click on Developer.
2. Click on Properties in the Controls group in the Developer menu.
3. Enter A1:W30 in the ScrollArea property.
This will limit scrolling to the specified range.
If you want to remove the ScrollArea restriction, just delete the entry from the ScrollArea property in the Developer menu.
2016-05-25 17:52:08
Lilah Knox
Hello,
Thank you for the information of my last request regarding hidden columns. It worked on this document, however, I noticed columns S through AC do not exist. Where could they have gone and why the skip?
I tried the Ctrl/Shift/> on an older Excel file and it didn't work. Rather, the selection went left instead of right. Hints?
Thanks!
Lilah
2016-05-24 15:55:45
Alec W
Lilah - Yes, Ctrl/Shift/=> does work, just as you would expect. The whole page does not grey, but looks like it as the display goes to the extreme right of the Excel window. If you drag the horizontal scroll bar back to the left, you will see your working columns are nice and bright.
2016-05-23 15:12:42
Lilah Knox
Hello, I have been trying to do this for columns to the right of the page. A communal document I was working on resulted with someone else's touch selecting and filling in certain rows to the end of eternity. How does one hide those columns? Shift+Ctrl+Right Arrow results in the whole page going "dark". Is the only option to set print area? Thanks for your help!
2016-05-21 17:49:29
Brett K
Can this same macro be used for hiding columns? When I tried it, all the columns when blank, which is no good.
2016-05-21 08:51:06
Kevin
Actually
Rows("31:1048576").EntireRow.Hidden = True ' or 31:65536
2016-05-21 08:46:04
Kevin
Or in the original theme knowing the required rows
Rows(31:1048576).EntireRow.Hidden = True ' or 31:65536
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.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2021 Sharon Parq Associates, Inc.
Comments