How to: Clear Groups in Worksheets
Applies to |
---|
The information in this topic applies only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office. Project type
Microsoft Office version
For more information, see Features Available by Application and Project Type. |
If you have groups of NamedRange controls or native Excel range objects in a worksheet, you can ungroup them..
Clearing Groups of NamedRange Controls
The following code example assumes you have three previously grouped Microsoft.Office.Tools.Excel.NamedRange controls in a worksheet: data2001, data2002, and dataAll.
To clear groups of NamedRange controls in a worksheet
Call the Ungroup method. This code must be placed in a sheet class, not in the ThisWorkbook class.
With Me .data2001.Ungroup() .data2002.Ungroup() .dataAll.Ungroup() End With
this.data2001.Ungroup(); this.data2002.Ungroup(); this.dataAll.Ungroup();
Clearing Groups of Native Excel Ranges
This code example assumes you have programmatically added and grouped three native Excel ranges in the worksheet: data2001, data2002, and dataAll.
To clear groups of Excel ranges in a worksheet
Call the Ungroup method.
With Me.Application .Range("data2001").Ungroup() .Range("data2002").Ungroup() .Range("dataAll").Ungroup() End With
this.Application.get_Range("data2001", missing).Ungroup(); this.Application.get_Range("data2002", missing).Ungroup(); this.Application.get_Range("dataAll", missing).Ungroup();
See Also
Tasks
How to: Create Groups in Worksheets
Concepts
The Variable missing and Optional Parameters in Office Solutions