共用方式為


ListColumns.Add Method (Excel)

Adds a new column to the list object.

Syntax

expression .Add(Position)

expression A variable that represents a ListColumns object.

Parameters

Name

Required/Optional

Data Type

Description

Position

Optional

Variant

Integer. Specifies the relative position of the new column that starts at 1. The previous column at this position is shifted outward.

Return Value

A ListColumn object that represents the new column.

Remarks

If Position is not specified, a new rightmost column is added. A name for the column is automatically generated. The name of the new column can be changed after the column is added.

Example

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

Set myNewColumn = ActiveWorkbook.Worksheets(1).ListObjects(1).ListColumns.Add

請參閱

概念

ListColumns Object

ListColumns Object Members