Share via


Worksheets Collection

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Worksheets
Aa168121.space(en-us,office.10).gifAa168121.parchild(en-us,office.10).gif

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

Using the Worksheets Collection

Use the Worksheets property to return the Worksheets collection.The following example moves all the worksheets to the end of the workbook.

  Worksheets.Move After:=Sheets(Sheets.Count)

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 the active workbook.

  Worksheets.Add Count:=2, Before:=Sheets(1)

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 active workbook.

  Worksheets(1).Visible = False

The Worksheet object is also a member of the Sheets collection. The Sheets collection contains all the sheets in the workbook (both chart sheets and worksheets).