Return to VBA Code Examples

Hide / Unhide Columns & Rows

This tutorial will demonstrate how to hide and unhide rows and columns using VBA.

Hide Columns or Rows

To hide columns or rows set the Hidden Property of the Columns or Rows Objects to TRUE:

Hide Columns

There are several ways to refer to a column in VBA. First you can use the Columns Object:

or you can use the EntireColumn Property of the Range or Cells Objects:

or

Hide Rows

Similarly, you can use the Rows Object to refer to rows:

or you can use the EntireRow Property of the Range or Cells Objects:

or

VBA Programming | Code Generator does work for you!

Unhide Columns or Rows

To unhide columns or rows, simply set the Hidden Property to FALSE:

or

Unhide All Columns or Rows

To unhide all columns in a worksheet, use Columns or Cells to reference all columns:

or

Similarily to unhide all columns in a worksheet use Rows or Cells to reference all rows:

or