Name

querytable.RowNumbers[= setting]

Synopsis

Set this property to True to display row numbers in the first column of the specified query table. The numbers do not display until the query table is refreshed. They will be reset each time the query table is refreshed. The following code adds row numbers to the first query table on the active worksheet:

With ActiveSheet.QueryTables(1)
    .RowNumbers = True
    .Refresh
End With

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.