[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IWorksheet.CopyAfter

CopyAfter Method

CopyAfter(IWorksheet)

Copies the sheet to the location after the specified sheet.

The copied sheet is inserted immediately after targetSheet. The target sheet can belong to the current workbook or another workbook.

Declaration
IWorksheet CopyAfter(IWorksheet targetSheet)
Function CopyAfter(targetSheet As IWorksheet) As IWorksheet
Parameters
Type Name Description
IWorksheet targetSheet

The sheet after which the copied sheet will be placed. It can be a sheet in the same workbook or another workbook.

Returns
Type Description
IWorksheet

The new copied sheet.

Examples
worksheet.Name = "Data";
worksheet.Range["A1"].Value = "Name";
IWorksheet summarySheet = workbook.Worksheets.Add();
summarySheet.Name = "Summary";
IWorksheet copiedSheet = worksheet.CopyAfter(summarySheet);
copiedSheet.Name = "Data Copy";