Skip to content

Latest commit

 

History

History
81 lines (55 loc) · 2.32 KB

Excel.Sheets.md

File metadata and controls

81 lines (55 loc) · 2.32 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Sheets object (Excel)
vbaxl10.chm151072
vbaxl10.chm151072
Excel.Sheets
048fd93c-bc27-4b58-358f-56fcee1710f8
04/02/2019
medium

Sheets object (Excel)

A collection of all the sheets in the specified or active workbook.

Remarks

The Sheets collection can contain Chart or Worksheet 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 Sheets property of the Workbook object to return the Sheets collection. The following example prints all sheets in the active workbook.

Sheets.PrintOut

Use the Add 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.

Sheets.Add type:=xlChart, count:=2, after:=Sheets(2)

Use Sheets (index), where index is the sheet name or index number, to return a single Chart or Worksheet object. The following example activates the sheet named Sheet1.

Sheets("Sheet1").Activate

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

Sheets(Array("Sheet4", "Sheet5")).Move before:=Sheets(1)

Methods

Properties

See also

[!includeSupport and feedback]