Copy Ranges of Excel

Introduction

In Excel, you can select a range, copy the range, then paste it with specific options to the same worksheet, other worksheets, or other files.

Copy Ranges Using Aspose.Cells

Aspose.Cells provides several overloaded Range.Copy methods to copy a range. It also offers Range.CopyStyle to copy only the style of a range and Range.CopyData to copy only the values of a range.

Copy Range

Create two ranges—the source range and the target range—and then copy the source range to the target range using the Range.Copy method.

See the following code:

Paste Range With Options

Aspose.Cells supports pasting a range with specific types.

Only Copy Data of the Range

You can also copy only the data using the Range.CopyData method, as shown in the following code:

Advanced topics