Worksheets Collection Object

Microsoft Office Web Components Visual Basic

Worksheets Collection Object

Multiple objects Worksheets
Workbook

A collection of all the Worksheet objects in the workbook. Each Worksheet object represents a worksheet.

Using the Worksheets Collection Object

Use the Worksheets property of Spreadsheet or Workbook object to return the Worksheets collection.

Use the Add method to create a new worksheet and add it to the collection. The following example adds two new worksheets before sheet one of Spreadsheet1.

Spreadsheet1.Worksheets.Add _
        Spreadsheet1.Worksheets(1), ,2
		

Use Worksheets(index), where index is the worksheet index number or name, to return a single Worksheet object. The following example hides worksheet one in the Spreadsheet1.

Spreadsheet1.Worksheets(1).Visible = False
		

The Worksheet object is also a member of the Sheets collection.