ListRows.Add Method (Excel)

Adds a new row to the table represented by the specified ListObject.

Syntax

expression .Add(Position, AlwaysInsert)

expression A variable that represents a ListRows object.

Parameters

Name

Required/Optional

Data Type

Description

Position

Optional

Variant

Integer. Specifies the relative position of the new row.

AlwaysInsert

Optional

Variant

Boolean. Specifies whether to always shift data in cells below the last row of the table when the new row is inserted, regardless if the row below the table is empty. If True, the cells below the table will be shifted down one row. If False, if the row below the table is empty, the table will expand to occupy that row without shifting cells below it; but if the row below the table contains data, those cells will be shifted down when the new row is inserted.

Return Value

A ListRow object that represents the new row.

Remarks

If Position is not specified, a new bottom row is added. If AlwaysInsert is not specified, the cells below the table will be shifted down one row (same as specifying True).

Example

The following example adds a new row to the default ListObject object in the first worksheet of the workbook. Because no position is specified, the new row is added to the bottom of the list.

Set myNewColumn = ActiveWorkbook.Worksheets(1).ListObject(1).ListRows.Add

See Also

Concepts

ListRows Object Members

ListRows Object