Return to VBA Code Examples

VBA Group Rows & Columns

This tutorial will demonstrate how to group and ungroup rows and columns in VBA.

Group Rows or Columns

To group rows or columns apply the Group Method to the rows or columns:


Ungroup Rows or Columns

To ungroup the rows or columns, simply use the Ungroup Method:


Expand All “Grouped” Outline Levels

To expand all grouped outline levels, use this line of code:

To collapse all outline levels, use this line of code:


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!