Copies an area of cells from another Worksheet to cells in this worksheet.

 public Area CopyPaste(Cell destCell, Area sourceArea, CopyPasteProperties properties)
Public Function CopyPaste(ByVal destCell As Cell, ByVal sourceArea As Area, ByVal properties As CopyPasteProperties) As Area

A Cell indicating the upper-left cell of the destination area.

An area from the source workbook from which to copy.

A CopyPasteProperties object that specifies the types of data to copy.

An Area object representing the set of cells populated with the copied values.

The copied data will overwrite the contents of the cells in this worksheet. You may specify the types of data copied (cell value, formulas, comments, formatting, etc.) using the CopyPasteProperties object.


          //--- Open the workbook and worksheet from which we will copy cells.
          Workbook sourceWb = xla.Open("MyDataSource.xls");
          Worksheet sourceWs = sourceWb[0];

          //--- Create the workbook and and get the worksheet
          //--- into which we will paste cells.
          Workbbok destWb = xla.Create("MyNewWorkbook");
          Worksheet destWs = destWb[0];

          //--- Define the area of cells to copy.
          Area srcArea = sourceWs.CreateArea("A1:F20");

          //--- Copy cell values, formulas and cell and number formatting.
          CopyPasteProperties copyPasteProps =
               sourceWb.CreateCopyPasteProperties(
               CopyPasteProperties.CopyPasteType.ValueFormulasAndFormatting);

          //--- Paste the data onto the destination worksheet.
          Cell whereToPaste = destSheet["A1"];
          destWs.CopyPaste(whereToPaste, srcArea, copyPasteProps);
        

          '--- Open the workbook and worksheet from which we will copy cells.
          Dim sourceWb As Workbook = xla.Open("MyDataSource.xls")
          Dim sourceWs As Worksheet = sourceWb(0)

          '--- Create the workbook and and get the worksheet
          '--- into which we will paste cells.
          Dim destWb As Workbook = xla.Create("MyNewWorkbook")
          Dim destWs As Worksheet = destWb(0)

          '--- Define the area of cells to copy.
          Dim srcArea As Area = sourceWs.CreateArea("A1:F20")

          '--- Copy cell values, formulas and cell and number formatting.
          Dim whereToPaste As Cell = destSheet("A1")
          Dim copyPasteProps As CopyPasteProperties = _
               sourceWb.CreateCopyPasteProperties( _
               CopyPasteProperties.CopyPasteType.ValueFormulasAndFormatting)

          '--- Paste the data onto the destination worksheet.
          destWs.CopyPaste("A1", srcArea, copyPasteProps)