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 lstcol as ListColumn
Set lstcol = ActiveCell.ListObject.ListColumns(Index:=1)

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 lstcol As ListColumn
For Each lstcol In ActiveCell.ListObject.ListColumns
Next lstcol


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.

Dim lstcol As ListColumn
Set lstcol = ActiveCell.ListObject.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.