04 InsertColumn - AndrewMB2/Logic-Architect-for-Excel-VBA GitHub Wiki
InsertColumn method
Inserts a column. Returns True if successful, otherwise False.
Applies to
| TableData | ArrData | RsetData | Xdata | XShared |
|---|---|---|---|---|
| ✓ |
Parameters
| Name | Type | Description |
|---|---|---|
| Field | String | Name of the column to be inserted. |
| Pos | Variant (optional) | Position of the column to be inserted (field name or number). |
| EntireColumn | Boolean (optional) | Whether to insert an entire column. |
Inserts a column at the position Pos (if Pos is omitted, inserts at the end), placing Field in the column header. If EntireColumn is True, an entire column is inserted, shifting everything to the right of the new column by one column. If False and not a table, a column is inserted for the number of rows in the TableData object and the cells shifted are just for these rows. If a table, a table column is inserted (which shifts cells for every row in the table). The user must ensure that there is nothing on the right which will prevent the insert (such as a longer table).