Name

listcolumn.ListDataFormat

Synopsis

Returns a reference to the ListDataFormat object for the list column. Use the ListDataFormat object to get information about the type of data that the column contains. For example, the following code highlights the required columns in a list:

Sub HighlightRequired(  )
    Dim ws As Worksheet, lst As ListObject, col As ListColumn
    Set ws = ActiveSheet
    Set lst = ws.ListObjects("Test List")
    For Each col In lst.ListColumns
        If col.ListDataFormat.Required Then
            col.Range.Font.Color = RGB(0, 0, 255)
        End If
    Next
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.