Class ListObject (Excel VBA)

The class ListObject represents a list object in the ListObjects collection.

The classes QueryTable, Range, SlicerCache and TableObject. give access to class ListObject

Member in collection

Item

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

Dim lstobj as ListObject
Set lstobj = ActiveCell.ListObject

The following procedures can be used to set variables of type ListObject: ListObjects.Add, ListObjects.Item, QueryTable.ListObject, Range.ListObject, SlicerCache.ListObject and TableObject.ListObject.

For Each

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

Dim lstobj As ListObject
For Each lstobj In Application.ListObjects
	
Next lstobj

Delete - Deletes the ListObject object and clears the cell data from the worksheet.

ExportToVisio - Exports a ListObject object to Visio.

Publish - Publishes the ListObject object to a server that is running Microsoft SharePoint Foundation.

Refresh - Retrieves the current data and schema for the list from the server that is running Microsoft SharePoint Foundation. This method can be used only with lists that are linked to a SharePoint site. If the SharePoint site is not available, calling this method returns an error.

Resize - The Resize method allows a ListObject object to be resized over a new range. No cells are inserted or moved.

Unlink - Removes the link to a Microsoft SharePoint Foundation site from a list. Returns Nothing.

Unlist - Removes the list functionality from a ListObject object. After you use this method, the range of cells that made up the list will be a regular range of data.

ListObjects.Add - Creates a new list object.

Properties

Name (Default member) - Returns or sets a String value that represents the name of the ListObject object. ListObjects.Item (Default member) - Returns a single object from a collection.

Active returns a Boolean value indicating whether a ListObject object on a worksheet is active—that is, whether the active cell is inside the range of the ListObject object.

AlternativeText returns or sets the descriptive (alternative) text string for the specified table.

AutoFilter filters a table using the AutoFilter feature.

Comment returns or sets the comment associated with the list object.

DataBodyRange returns a Range object that represents the range of values, excluding the header row, in a table.

DisplayName returns or sets the display name for the specified ListObject object.

DisplayRightToLeft true if the specified ListObject is displayed from right to left instead of from left to right. False if the object is displayed from left to right.

HeaderRowRange returns a Range object that represents the range of the header row for a list.

InsertRowRange returns a Range object representing the Insert row, if any, of a specified ListObject object.

ListColumns returns a ListColumns collection that represents all the columns in a ListObject object.

ListRows returns a ListRows object that represents all the rows of data in the ListObject object.

QueryTable returns the QueryTable object that provides a link for the ListObject object to the list server.

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

SharePointURL returns a String representing the URL of the SharePoint list for a given ListObject object.

ShowAutoFilter returns Boolean to indicate whether the AutoFilter will be displayed.

ShowAutoFilterDropDown true when the AutoFilter drop-down for the ListObject object is displayed.

ShowHeaders returns or sets if the header information should be displayed for the specified ListObject object.

ShowTableStyleColumnStripes returns or sets if the Column Stripes table style is used for the specified ListObject object.

ShowTableStyleFirstColumn returns or sets if the first column is formatted for the specified ListObject object.

ShowTableStyleLastColumn returns or sets if the last column is displayed for the specified ListObject object.

ShowTableStyleRowStripes returns or sets if the Row Stripes table style is used for the specified ListObject object.

ShowTotals gets or sets a Boolean to indicate whether the Total row is visible.

Slicers returns a list of the table slicers associated with a ListObject.

Sort gets or sets the sort column or columns and sort order for the ListObject collection.

SourceType returns an XlListObjectSourceType value that represents the current source of the list.

Summary returns or sets the description associated with the alternative text string for the specified table.

TableObject returns a TableObject object.

TableStyle gets or sets the table style for the specified Listtablestyle tablestyle. Read/write Variant.

TotalsRowRange returns a Range object representing the Total row, if any, from a specified ListObject object.

XmlMap returns an XmlMap object that represents the schema map used for the specified table.

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

AutoFilter - Represents autofiltering for the specified worksheet.

ListColumns - A collection of all the ListColumn objects in the specified ListObject object.

ListRows - A collection of all the ListRow objects in the specified ListObject object.

QueryTable - Represents a worksheet table built from data returned from an external data source, such as a SQL server or a Microsoft Access database.

Range - Represents a cell, a row, a column, a selection of cells containing one or more contiguous blocks of cells, or a 3D range.

Slicers - A collection of Slicer objects.

Sort - Represents a sort of a range of data.

TableObject - Represents a worksheet table built from data returned from a PowerPivot model.

TableStyle - Represents a single style that can be applied to a table or slicer.

XmlMap - Represents an XML map that has been added to a workbook.