Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Unhiding a Single Column.

Unhiding a Single Column

by Allen Wyatt
(last updated September 1, 2016)

4

I regularly hide and unhide columns in my worksheets. If I have an entire range of columns hidden, I find it a bother to unhide a single column out of all those hidden. For instance, if I hide columns C:M, and I want to unhide column F, then I need to unhide the entire range and then rehide C:E and G:M. (There are other ways I could accomplish the same task, but none of them are particularly endearing.)

However, I find that a single column can be unhidden very easily using a macro. Consider the following:

Sub UnhideSingleColumn()
    Dim Col As String
    Dim rng As Range

StartHere:
    Col = InputBox("Enter column to unhide.", "Unhide Column")
    If Col = "" Then Exit Sub
    On Error Resume Next
    ' if not a valid range, an error occurs
    Set rng = ActiveSheet.Columns(Col)
    If Err.Number <> 0 Then
        On Error GoTo 0
        Err.Clear
        MsgBox "Invalid input! Please input a valid column."
        GoTo StartHere
    End If

    rng.EntireColumn.Hidden = False

    MsgBox "Column " & UCase(Col) & " is now visible.", _
      vbOKOnly, "Unhide Specified Column"
    Set rng = Nothing
    On Error GoTo 0
End Sub

The macro prompts the user for which column should be made visible, and then tries to select that column. If the column cannot be selected, then an error is generated and the user is again asked for input. If the column can be selected, then its .Hidden property is turned off, thereby making the column visible.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2405) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Unhiding a Single Column.

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

Numbering with Sequence Fields

One of the most powerful and versatile fields you can use in Word is the SEQ field. This tip shows how you can use the field ...

Discover More

Using Your Own File Extensions

Don't like the workbook file extensions used by Excel? You can specify your own extensions, as discussed in this tip.

Discover More

Changing AutoFormatting Rules

The AutoFormat feature of Word can be configured to make changes to a variety of conditions in your document. Here's how to ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More ExcelTips (menu)

Hiding and Unhiding Columns

Want to hide a column so it doesn't appear in the worksheet? It's easy to do using the formatting capabilities of Excel.

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

Hiding Columns Not within a Date Range

Want to automatically hide some columns that don't meet a date criteria that you set? You can't do it automatically, but you ...

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. 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 two minus 2?

2012-07-09 02:58:31

g.subramania sarma

I want to hide a row based on the reply to a question which is appearing in a cell

For Eg, if the reply to cell A7 is "Yes",
the rows 8 to 10 should hide

Is it possible and if so how

Advance thanks

G.S.Sarma


2012-03-19 21:49:22

Hemant Vyas

Using Hans method till jump to cell address and then just have a key activated macro to unhide column may be speedier.


2012-03-19 10:25:37

David Bonin

Using the above example, I would type a cell address for the desired column in the name box (the little field immediately above "A" designating column A) and then unhide the column using the familiar menu Format > Column > Unhide. Any address in the column will do, eg: F1 or F872. I can use ranges, too. While this may not be quite as short as a macro, it uses familiar steps to do an uncommon job -- always a good thing.


2012-03-19 02:02:03

Hans Kiesewetter

I use an other method, no macro.
Use F5/Goto and enter a cell adress to jump to a cell in the hidden column. Then click format/column/unhide


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon 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.