Hide Columns with No Data in Excel – 4 Methods

This is the sample dataset.

To hide all columns except for the first 3:Sample Dataset to Hide Columns in Excel with No Data

 


Method 1 – Hide Columns with No Data Using the Format Tool

Steps:

  • Click the header of column D.

Select the D Column

 

  • Press Ctrl + Shift + Right arrow.

Press Ctrl + Shift + Right Arrow to Hide Columns with No data in Excel

You selected all unused columns.

  • Go to the Home tab >> Cells >> Format >> Hide & Unhide >> Hide Columns.

Use Format Tool to Hide Excel Columns with No Data

This is the output.

Dataset with Hidden Columns

Read More: How to Hide Columns with Button in Excel


Method 2 – Hide Columns with No Data Using the Hide Command

Steps:

  • Click the header of column D.

Click the Header of D Column to Hide Columns with No Data in Excel

  • Press Ctrl + Shift + Right arrow.

Press Ctrl + Shift + Right Arrow

  • Place the cursor on any column header.
  • Right-click.
  • Choose Hide.

Choose the Hide Option to Hide Columns in Excel with No Data

This is the output.

Dataset with Hidden Columns

Read More: How to Hide Multiple Columns in Excel


Method 3 – Use a Keyboard Shortcut to Hide Columns with No Data

Steps:

  • Click the header of column D.

Select the Column D Header

  • Press Ctrl + Shift + Right Arrow.

Press Ctrl + Shift + Right Arrow to Select Required Columns

 

  • Press Ctrl + 0.

Use Keyboard Shortcut to Hide Columns with No Data in Excel

This is the output.

Dataset with Hidden Columns

Read More: How to Hide Columns Without Right Click in Excel


Method 4 – Apply a VBA Code

Steps:

  • Go to the Developer tab >> Visual Basic.

Access the Visual Basic Tool

  • In the Microsoft Visual Basic for Applications window, click Sheet5 in Microsoft Excel Object.
  • Enter the following code in the code window.
Sub Hide_Blank_Columns()
    Columns("D:XFD").Hidden = True
End Sub

Write VBA Code in VBA window to Hide Columns with No Data in Excel

  • Press Ctrl + S to save the code.
  • Go to the File tab.

Access the File Tab

  • Choose Save As in the File tab.

Choose the Save As Option

  • Click Browse.

Excel Save As Window

  • In the Save As dialog box, select Save as type:
  • Choose the .xlsm file and click Save.

Save the Excel as .xlsm to Enable Macro

  • Go to the Developer tab >> Visual Basic.

Access the Visual Basic Tool

  • In Microsoft Visual Basic for Applications will open again.
  • Select Sheet5 and click Run.

Run the VBA Code to Hide Columns with No Data in Excel

  • In Macros, choose the Macro Name: and click Run.

Run the Macro to Hide Columns with No data in Excel

This is the output.

Dataset with Hidden Columns

Read More: How to Hide and Unhide Columns in Excel


How to Unhide Hidden Columns?

Steps:

  • Click the last column header (C here) and drag your mouse to the right.

Select the Hidden Columns

  • Right-click .
  • Choose Unhide.

Choose the Unhide Option to Unhide Columns

This is the output.

Dataset with Unhidden Columns


Download Practice Workbook

Download the practice workbook.


Related Articles


<< Go Back to Hide Columns | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Tanjim Reza
Tanjim Reza

Md. Tanjim Reza Tanim, a BUET graduate in Naval Architecture & Marine Engineering, contributed over one and a half years to the ExcelDemy project. As an Excel & VBA Content Developer, he authored 100+ articles and, as Team Leader, reviewed 150+ articles. Tanim, leading research, ensures top-notch content on MS Excel features, formulas, solutions, tips, and tricks. His expertise spans Microsoft Office Suites, Automating Finance Templates, VBA, Python, and Developing Excel Applications, showcasing a multifaceted commitment to the... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo