Remarks

The Sheets collection can contain or objects.

The Sheets collection is useful when you want to return sheets of any type. If you need to work with sheets of only one type, see the object topic for that sheet type.

Example

Use the property to return the Sheets collection. The following example prints all sheets in the active workbook.

Visual Basic for Applications
Sheets.PrintOut

Use the method to create a new sheet and add it to the collection. The following example adds two chart sheets to the active workbook, placing them after sheet two in the workbook.

Visual Basic for Applications
Sheets.Add type:=xlChart, count:=2, after:=Sheets(2)

Use Sheets(), where is the sheet name or index number, to return a single Chartor Worksheetobject. The following example activates the sheet named "sheet1."

Visual Basic for Applications
Sheets("sheet1").Activate

Use Sheets() to specify more than one sheet. The following example moves the sheets named "Sheet4" and "Sheet5" to the beginning of the workbook.

Visual Basic for Applications
Sheets(Array("Sheet4", "Sheet5")).Move before:=Sheets(1)
Sheets Collection Sheets Collection Object

See also:

index index array