NativeExcel for .Net Developer's Reference

IRange.CopyMethod(Object)

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

[Visual Basic]
SubCopy(_
ByValDestinationAsObject_
)
[C#]
voidCopy(
objectDestination
);
[C++]
voidCopy(
Object*Destination
);
[JScript]
functionCopy(
ObjectDestination
);

Parameters

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

Example

This example copies 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"].Copy(dstrange); 
[VisualBasic]
 Dim dstrange As IRange = book.Worksheets("Sheet2").Range("E5:H8")
 book.Worksheets("Sheet1").Range("A1:D4").Copy(dstrange)
[C++]
 IRange* dstrange = book->Worksheets->Item[S"Sheet2"]->Range->Item[S"E5:H8"];
 book->Worksheets->Item[S"Sheet1"]->Range->Item[S"A1:D4"]->Copy(dstrange); 
This example copies the range A1:D4 on Sheet1 into range E5:H8 on the same sheet.
[C#]
 IWorksheet sheet = book.Worksheets["Sheet1"];
 sheet.Range["A1:D4"].Copy("E5:H8");
[VisualBasic]
 Dim sheet As IWorksheet = book.Worksheets("Sheet1")
 sheet.Range("A1:D4").Copy("E5:H8")
[C++]
 IWorksheet* sheet = book->Worksheets->Item[S"Sheet1"];
 sheet->Range->Item[S"A1:D4"]->Copy(S"E5:H8");     

See Also

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