Sheets Method

Applies To

Application Object, Workbook Object.

Description

Accessor. Returns an object that represents a single sheet (Syntax 1) or a collection of sheets (Syntax 2) in the workbook. Read-only. A sheet can be a Chart object, DialogSheet object, Module object, or Worksheet object.

Syntax 1

object.Sheets(index)

Syntax 2

object.Sheets

object

Optional for Application, required for Workbook. The object to which this method applies.

index

Required for Syntax 1. The name or number of the sheet to return.

Remarks

Using this method with no object qualifier is equivalent to ActiveWorkbook.Sheets.

See Also

DialogSheets Method, Modules Method, Worksheets Method.

Example

This example creates a new worksheet and then places a list of the active workbook's sheet names in the first column.


Set newSheet = Sheets.Add(Type:=xlWorksheet)
For i = 1 To Sheets.Count
    newSheet.Cells(i, 1).Value = Sheets(i).Name
Next i