NativeExcel for .Net Developer's Reference

IWorksheets.AddAfterMethod(Object, Int32)

Creates new worksheets. You can insert the new worksheets after an existing worksheet.

[Visual Basic]
FunctionAddAfter(_
ByValAfterAsObject,_
ByValCountAsInteger_
)AsIWorksheet
[C#]
IWorksheetAddAfter(
objectAfter,
intCount
);
[C++]
IWorksheet*AddAfter(
Object*After,
intCount
);
[JScript]
functionAddAfter(
ObjectAfter,
intCount
):IWorksheet;

Parameters

After
An object that specifies the worksheet after which the new worksheet is added. Can be either an IWorksheet interface, Number which indicates the worksheet index or String which indicates the worksheet name.
Count
The number of worksheets to be added.

Return Value

IWorksheet interface.

Example

This example creates two new worksheets after sheet with name "Sheet2".

[C#]
book.Worksheets.AddAfter("Sheet2", 2);
[VisualBasic]
book.Worksheets.AddAfter("Sheet2", 2)
[C++]
book->Worksheets->AddAfter(S"Sheet2", 2);
This example creates a new worksheet after first worksheet.
[C#]
book.Worksheets.AddAfter(1, 1);
[VisualBasic]
book.Worksheets.AddAfter(1, 1)
[C++]
book->Worksheets->AddAfter(1, 1);

See Also

IWorksheets Interface | NativeExcel Namespace | IWorksheets.AddAfter Overload List