Free Support Forum - aspose.com

Copy current sheet

Hi
I am using aspose.cells for vb.net and can copy from a predetermined sheet to a new sheet-
iSheetid += 1
sheet = workbook.Worksheets(workbook.Worksheets.Add(SheetType.Worksheet))
sheet.Copy(workbook.Worksheets(“Temp”))
sheet.Name = oWhirlpoolSheet.Customer.Substring(0, 4) & iSheetid.ToString
cells = sheet.Cells

How can I copy the current sheet to a new sheet?

Regards
BOB Hamill

Hi,

Well, you may also use Worksheets.AddCopy method to copy your desired sheet. For current worksheet, do you mean the active sheet? if so, you may use Worksheets.ActiveSheetIndex attribute to get the active sheet in the workbook.

//To create a duplicate/copy of the first worksheet.
workbook.Worksheets.AddCopy(0)


Dim i as Integer =
workbook.Worksheets.ActiveSheetIndex