Skip to main content

ListObject.ListColumns property

Table of contents
  1. Syntax
  2. Example

Returns a ListColumns collection that represents all the columns in a ListObject object. Read-only.



expression A variable that represents a ListObject object.


The following example displays the name of the second column in the ListColumns collection object as created by a call to the ListColumns property. For this code to run, the Sheet1 worksheet must contain a table.

Sub DisplayColumnName()
    Dim wrksht As Worksheet
    Dim objListObj As ListObject
    Dim objListCols As ListColumns
    Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
    Set objListObj = wrksht.ListObjects(1)
    Set objListCols = objListObj.ListColumns
    Debug.Print objListCols(2).Name
End Sub

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>