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 November 26, 2016)

4

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

Writing a Macro from Scratch

Creating macros can help extend what you can do in Word. If you work with macros, you know that creating macros from scratch ...

Discover More

Customizing Quick Access Toolbar Icons

The standard way to customize Excel is to add tools to the Quick Access Toolbar. The program provides only a limited ...

Discover More

Averaging the Last Numbers in a Column

Need to calculate a running average for the last twelve values in a constantly changing range of values? The formula ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (ribbon)

Countering Compressed Columns

If you open a workbook and find that the width of some of your columns has been changed, the discovery can be frustrating. ...

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 the ...

Discover More

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 is ...

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 seven less than 7?

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.