Class ListColumn (Excel VBA)

The class ListColumn represents a column in a table.

The main procedures of class ListColumn are Delete and ListColumns.Add


To use a ListColumn class variable it first needs to be instantiated, for example

Dim lstobj As ListObject: Set lstobj = 
Dim lstcol As ListColumn
Set lstcol = lstobj.ListColumns.Add()

The following procedures can be used to set variables of type ListColumn: ListColumns.Item, ListColumns.Add and ListObject.ListColumns

For Each

Here is an example of processing the ListColumn items in a collection.

Dim lstobj As ListObject: Set lstobj = 
Dim lstcolListColumn As ListColumn
For Each lstcolListColumn In lstobj.ListColumns
Next lstcolListColumn


These are the main methods of the ListColumn class

Delete - Deletes the column of data in the list.

ListColumns.Add - Adds a new column to the list object.

Set myNewColumn = ActiveWorkbook.Worksheets(1).ListObjects(1).ListColumns.Add


DataBodyRange returns a Range object that is the size of the data portion of a column.

Index returns a Long value that represents the index number of the ListColumn object within the ListColumns collection.

Name returns or sets a String value that represents the name of the list column.

Parent returns the parent object for the specified object. Read-only.

Range returns a Range object that represents the range to which the specified list object applies.

Total returns the Total row for a ListColumn object.

TotalsCalculation determines the type of calculation in the Totals row of the list column based on the value of the XlTotalsCalculation enumeration.


XPath returns an XPath object that represents the XPath of the element mapped to the specified Range object. The context of the range determines whether the action succeeds or returns an empty object.

ListColumns.Count returns an Integer value that represents the number of objects in the collection.

ListColumns.Item returns a single object from a collection.

ListColumns.Parent returns the parent object for the specified object. Read-only.