Microsoft Office Tutorials and References
In Depth Information
19.3.33 Insert Method
where InsertAmount is an integer between 0 and 15. However, in this case, the InsertAmount
parameter specifies the amount to change the current indent for the range.
19.3.33 Insert Method
This method inserts a cell or range of cells into the worksheet, shifting existing cells to make room.
The syntax is:
RangeObject .Insert( Shift )
where Shift can be one of the XlInsertShiftDirection constants:
xlShiftToRight = -4161
xlShiftDown = -4121
If the Shift argument is omitted, Excel will decide upon the shift direction based on the shape of
the range. (As with other cases when Excel will guess, I recommend against allowing it to do so.)
19.3.34 Locked Property
This property returns the Locked status of the cells in the range or can be used to lock the range.
The property returns Null if the range contains both locked and unlocked cells.
19.3.35 Merge-Related Methods and Properties
It is quite common to create a merged cell (that is, a single cell created by combining several
adjacent cells) for use as a title or heading, for instance.
The Merge method creates a merged cell from the specified range. The syntax is:
RangeObject .Merge( Across )
where Across is an optional Variant that should be set to True to merge the cells in each row of
the range into a single cell per row or False (the default) to merge all cells in all rows into a
single cell. Note that when the individual cells contain data, the merged cell will contain only the
data from the upper-left cell. Hence, the data in all other cells will be lost.
The UnMerge method separates a merged area into individual cells. Its syntax is:
Note that as long as RangeObject contains any of the cells within a merged range, even if it
does not contain all merged cells or if it contains additional cells not in the merged area, the
method will unmerge the merged range. Note that calling the UnMerge method on a range that
does not contain merged cells has no effect and does not produce a runtime error.
The MergeArea property applies only to ranges that consist of a single cell (otherwise an error
occurs). The property returns a Range object representing the merged range containing that cell
(or the cell itself if it is not part of a merged range).