NativeExcel for .Net Developer's Reference

IRange.Move Method (Object)

Moves a cell or a range of cells to the specified range.

[Visual Basic]
Sub Move( _ 
   ByVal Destination As Object _ 
)
[C#]
void Move(
   object Destination
);
[C++]
void Move(
   Object* Destination
);
[JScript]
function Move(
   Object Destination
);

Parameters

Destination
Specifies the new range to which the specified range will be moved. Can be either an IRange interface or String which represents a range.

Example

This example moves the range A1:D4 on Sheet1 into range E5:H8 on Sheet2.

[C#]
 IRange dstrange = book.Worksheets["Sheet2"].Range["E5:H8"];
 book.Worksheets["Sheet1"].Range["A1:D4"].Move(dstrange); 
[Visual Basic]
 Dim dstrange As IRange = book.Worksheets("Sheet2").Range("E5:H8")
 book.Worksheets("Sheet1").Range("A1:D4").Move(dstrange)
[C++]
 IRange* dstrange = book->Worksheets->Item[S"Sheet2"]->Range->Item[S"E5:H8"];
 book->Worksheets->Item[S"Sheet1"]->Range->Item[S"A1:D4"]->Move(dstrange); 
This example moves the range A1:D4 on Sheet1 into range E5:H8 on the same sheet.
[C#]
 IWorksheet sheet = book.Worksheets["Sheet1"];
 sheet.Range["A1:D4"].Move("E5:H8");
[Visual Basic]
 Dim sheet As IWorksheet = book.Worksheets("Sheet1")
 sheet.Range("A1:D4").Move("E5:H8")
[C++]
 IWorksheet* sheet = book->Worksheets->Item[S"Sheet1"];
 sheet->Range->Item[S"A1:D4"]->Move(S"E5:H8");     

See Also

IRange Interface | NativeExcel Namespace | IRange.Move Overload List | Copy Method