Workbook workbook = new Workbook();
// Access a collection of worksheets.
WorksheetCollection worksheets = workbook.Worksheets;
// Access a worksheet by its index.
Worksheet worksheet1 = workbook.Worksheets;
// Access a worksheet by its name.
Worksheet worksheet2 = workbook.Worksheets["Sheet2"];
Dim workbook As New Workbook()
' Access a collection of worksheets.
Dim worksheets As WorksheetCollection = workbook.Worksheets
' Access a worksheet by its index.
Dim worksheet1 As Worksheet = workbook.Worksheets(0)
' Access a worksheet by its name.
Dim worksheet2 As Worksheet = workbook.Worksheets("Sheet2")
A worksheet index is zero-based. It specifies the worksheet position within a collection. The worksheet name is unique within the collection, and is shown on a worksheet tab.
Was this page helpful?
Thanks for your feedback! Any other suggestions? Tell us here.