NativeExcel for .Net Developer's Reference

IRange.Delete Method ()

Deletes a cell or a range of cells from the worksheet and shifts other cells up to replace deleted cells.

[Visual Basic]
Sub Delete()
[C#]
void Delete();
[C++]
void Delete();
[JScript]
function Delete();

Example

This example deletes range D2:F5 from sheet one and shifts other cells up.

[C#]
 book.Worksheets[1].Range["D2:F5"].Delete(); 
[Visual Basic]
 book.Worksheets(1).Range("D2:F5").Delete()
[C++]
 book->Worksheets->Item[1]->Range->Item[S"D2:F5"]->Delete(); 

See Also

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