Range.Insert (Excel)

Inserts a cell or a range of cells into the worksheet or macro sheet and shifts other cells away to make space.

There is no value for CopyOrigin that is equivalent to Clear Formatting when inserting cells interactively in Excel. To achieve this, use the ClearFormats method.

Insert (Shift, CopyOrigin)


With Range("B2:E5")
    .Insert xlShiftDown
    .ClearFormats
End With

Arguments

Optional arguments

The following arguments are optional

Shift (XlInsertShiftDirection) - Specifies which way to shift the cells. Can be one of the following XlInsertShiftDirection constants: xlShiftToRight or xlShiftDown. If this argument is omitted, Microsoft Excel decides based on the shape of the range.

Possible return values are xlShiftDown - Shift cells down, xlShiftToRight - Shift cells to the right.

CopyOrigin (XlInsertFormatOrigin) - The copy origin; that is, from where to copy the format for inserted cells. Can be one of the following XlInsertFormatOrigin constants: xlFormatFromLeftOrAbove (default) or xlFormatFromRightOrBelow.

Possible return values are xlFormatFromLeftOrAbove - Copy the format from cells above and/or to the left, xlFormatFromRightOrBelow - Copy the format from cells below and/or to the right.