NativeExcel2 for .Net Developer's Reference

IRange.InsertMethod(XlInsertShiftDirection)

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

[Visual Basic]
SubInsert(_
ByValShiftAsXlInsertShiftDirection_
)
[C#]
voidInsert(
XlInsertShiftDirectionShift
);
[C++]
voidInsert(
XlInsertShiftDirectionShift
);
[JScript]
functionInsert(
XlInsertShiftDirectionShift
);

Parameters

Shift
XlInsertShiftDirection. Specifies which way to shift the cells.

Example

This example inserts range B2:F5 into sheet one and shifts other cells right.

[C#]
 book.Worksheets[1].Range["B2:F5"].Insert(XlInsertShiftDirection.xlShiftRight); 
[VisualBasic]
 book.Worksheets(1).Range("B2:F5").Insert(XlInsertShiftDirection.xlShiftRight)
[C++]
 book->Worksheets->Item[1]->Range->Item[S"B2:F5"]->Insert(XlInsertShiftDirection::xlShiftRight); 

See Also

IRange Interface | NativeExcel Namespace | IRange.Insert Overload List | Delete Method | XlInsertShiftDirection Enumeration