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: Hiding and Unhiding Columns.

Hiding and Unhiding Columns

by Allen Wyatt
(last updated September 29, 2020)

8

Excel allows you to easily hide columns in your worksheet. Once a column is hidden, it will not be shown on the display or printed when you print the worksheet. The column is not deleted; its width is simply reduced to 0. To hide a column, follow these steps:

  1. Select any cell in the column (or columns) you want to hide.
  2. Make sure the Home tab of the ribbon is displayed.
  3. Click the Format tool in the Cells group. Excel displays a series of options.
  4. Click Hide & Unhide and then click Hide Columns.

You can also hide columns by selecting those you want to hide, right-clicking on the selected columns, and choosing Hide from the resulting Context menu.

The columns disappear from the display. Notice, however, that the other columns do not change; they still retain the same column labels. Excel does, however, leave a thick bar in the column header area to indicate where the hidden columns would normally appear.

To later unhide the columns, follow these steps:

  1. Select the columns on both sides of those that are hidden.
  2. Make sure the Home tab of the ribbon is displayed.
  3. Click the Format tool in the Cells group. Excel displays a series of options.
  4. Click Hide & Unhide and then click Unhide Columns.

You can also unhide columns by selecting the columns on both sides of those you want to unhide, right-clicking on the selected columns, and choosing Unhide from the resulting Context menu.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (6864) 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 and Unhiding Columns.

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

Automatically Protecting After Input

Do you want user-entered data to be immediately protected so that it cannot be changed? This can be done relatively ...

Discover More

Rounding to the Nearest Quarter Hour

When entering times in a worksheet, you may have a need to round whatever you enter to the nearest 15-minute increment. ...

Discover More

Selecting a Range of Cells Relative to the Current Cell

When processing information in a macro, you often need to select different cells relative to the currently selected ...

Discover More

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!

More ExcelTips (ribbon)

Unhiding a Single Column

In a worksheet with lots of hidden columns it is a real pain to try to unhide just one or two columns. The best solution ...

Discover More

Double-Clicking to Widen Columns Won't Work

One way you can widen the columns in a worksheet to fit whatever is in the column is by double-clicking the right edge of ...

Discover More

Unhiding Columns that are Persistently Hidden

If you were trying to format a worksheet and nothing you did could make the first two columns appear, would you be ...

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 nine more than 2?

2020-09-29 14:53:43

Philip

Instead of using a macro to hide predefined columns for printing, why not set up custom views ? Doesn’t require VBA, file format stays xlsx and is easier to maintain (also more versatile as it also supports filtering and print area settings)


2020-09-02 13:50:49

J. Woolley

@Andy
You might want to use my new FindAndUnhide macro in the M_Text module of My Excel Toolbox: https://sites.google.com/view/MyExcelToolbox/


2020-08-21 10:57:23

J. Woolley

@Andy
This might be a bit awkward, but after using Ctrl+F to find the hidden cell, press Esc to close the Find dialog then Ctrl+Shift+9 or Ctrl+( to unhide the row. To re-hide the row, press Ctrl+9. To find the next, press Ctrl+F+Enter.
To hide/unhide a column, use Ctrl+0/Ctrl+Shift+0.


2020-08-19 06:23:47

Andy

I have a large worksheet and use the 'collapse row' function to make it look less busy. Problem is if someone searches for data that is contained within the collapsed rows, the normal Ctrl-F search will find it but just underlines the cell above which is not easy to see. Is there a way of a simple search opening the collpased rows to show the cell containing the searched date?


2017-03-13 18:08:33

Tim J

Why bother with the ribbon, except for unhiding columns?
Surely :
CTRL+9 hide selected row
CTRL+SHIFT+( unhide column in selection

CTRL+0 (zero) hide selected column

However, I have never gotten this to work. Is there a bug?
CTRL+SHIFT+) unhide column in selection

(I also use outlines on sheets I want to hide/unhide rows and columns frequently)


2016-11-29 11:04:11

Gary Lundblad

I like your hiding macro Graham; however; how hard would it be to have the trigger be a value rather than a comment? If the trigger is a value it can be dynamic. How would you change the code if it were say the value "True," in the first column, or even "Hide," if that's easier, rather than a cell comment.

Thank you Graham!

Gary


2016-11-27 02:47:04

Servi

I find it easy to "GROUP" columns or rows (Data-ribbon, outline - Group) that I frequently should hide or unhide. You then get the + and -buttons on the side bar or top bar to expand or collapse grouped columns and rows. You also can "ungroup" rows and columns you do not want to keep into it. Adjoining columns and rows will be "grouped" together. If you want to collapse or expand them separately then it is best to insert a very narrow column or row in between.

Good luck.


2016-11-26 06:27:12

Graham

If you regularly want to hide and unhide a pre-defined set of columns then the macro below could be used. For example I use this to hide some columns during printing.

All that you need to do is add a Comment in Row 1 for any column that you wish to hide. The comment should start with the characters HID, upper or lower case.

NOTE - When creating a new cell comment some versions of Excel start the comment with the user's name. This needs to be removed.

By use of the Static definition the macro toggles between hidden and unhidden.

MACRO HERE

Option Explicit

Static Sub Hiding()

' Hiding Macro
' Toggles a pre-defined selection of columns as hidden or unhidden
' Columns defined by cells in FIRST row having a COMMENT starting with the
' letters "HID", that is any word such as "Hide", "Hidden", "Hiding", etc.
' Checks if Worksheet is initially Protected, asks for password if needed
' but reprotects WITHOUT password.

Dim active_column, actcell, hidden, protected

Application.ScreenUpdating = False ' Runs faster & stops screen flicker
Application.Calculation = xlManual
ActiveWorkbook.PrecisionAsDisplayed = False

If ActiveSheet.ProtectContents Then
protected = "Yes"
ActiveSheet.Unprotect ' Needed to allow hiding/unhiding to occur
End If

Set actcell = ActiveCell ' Stores location of "active" cell

hidden = hidden + 1
' initial value of hidden is zero if "first use" or
' "last used" value, due to "Static" statement in Sub title

If hidden > 2 Then hidden = 1

If hidden = 1 Then ' Change to "all" columns visible
Cells.Select
Selection.EntireColumn.hidden = False
Else ' Change to "selected" columns visible
Selection.SpecialCells(xlLastCell).Activate
active_column = ActiveCell.Column 'Starts search in last column currently in use.
Do While active_column > 0
If UCase(Left(Cells(1, active_column).NoteText, 3)) = "HID" Then
' Any cell in top row with COMMENT starting with
' Hide, Hidden, Hiding, etc. Upper or lower case.
Cells(1, active_column).Select
Selection.EntireColumn.hidden = True
End If
active_column = active_column - 1
Loop
End If

If protected = "Yes" Then
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios _
:=True ' Re-establishes protection, without password
End If

actcell.Select ' Re-establishes active cell position

Application.ScreenUpdating = True

Application.Calculation = xlAutomatic
ActiveWorkbook.PrecisionAsDisplayed = False
Application.ScreenUpdating = True 'Resets screen updating

End Sub


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.