NativeExcel for .Net Developer's Reference

IRange.MoveMethod(Object)

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

[Visual Basic]
SubMove(_
ByValDestinationAsObject_
)
[C#]
voidMove(
objectDestination
);
[C++]
voidMove(
Object*Destination
);
[JScript]
functionMove(
ObjectDestination
);

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); 
[VisualBasic]
 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");
[VisualBasic]
 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