NativeExcel2 for .Net Developer's Reference

IRange.MoveMethod(Object, XlPasteType)

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

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

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.
PasteMode
XlPasteType. Indicates the part of the range to be moved.

Example

This example moves the values of 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, XlPasteType.xlPasteValues); 
[VisualBasic]
 Dim dstrange As IRange = book.Worksheets("Sheet2").Range("E5:H8")
 book.Worksheets("Sheet1").Range("A1:D4").Move(dstrange, XlPasteType.xlPasteValues)
[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, XlPasteType::xlPasteValues); 
This example moves the values of 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", XlPasteType.xlPasteValues);
[VisualBasic]
 Dim sheet As IWorksheet = book.Worksheets("Sheet1")
 sheet.Range("A1:D4").Move("E5:H8", XlPasteType.xlPasteValues)
[C++]
 IWorksheet* sheet = book->Worksheets->Item[S"Sheet1"];
 sheet->Range->Item[S"A1:D4"]->Move(S"E5:H8", XlPasteType::xlPasteValues);     

See Also

IRange Interface | NativeExcel Namespace | IRange.Move Overload List | XlPasteType Enumeration