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

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

 

VBA Coding Made Easy

Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users! vba save as


Learn More!