Range.Copy

Copy(Range, PasteOptions)

Copying the range with paste special options.

public void Copy(Range range, PasteOptions options)
ParameterTypeDescription
rangeRangeThe source range.
optionsPasteOptionsThe paste special options.

See Also


Copy(Range)

Copies data (including formulas), formatting, drawing objects etc. from a source range.

public void Copy(Range range)
ParameterTypeDescription
rangeRangeSource Range object.

Examples


[C#]

//Instantiating a Workbook object
Workbook workbook = new Workbook();
// Get the first Worksheet Cells.
Cells cells = workbook.Worksheets[0].Cells;
Range range1 = cells.CreateRange("A1:A5");
Range range2 = cells.CreateRange("A6:A10");
//Copy the range.
range1.Copy(range2);
//Save the Excel file
workbook.Save("book1.xlsm");

 [Visual Basic]

'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()
'Get the first Worksheet Cells.
Dim cells as Cells = workbook.Worksheets[0].Cells
Range range1 = cells.CreateRange("A1:A5")
Range range2 = cells.CreateRange("A6:A10")
//Copy the range
range1.Copy(range2)
'Save the Excel file
workbook.Save("book1.xlsm")

See Also