Syntax

expression.Worksheets

expression A variable that represents an Application object.

Remarks

Using this property without an object qualifier returns all the worksheets in the active workbook.

This property doesn't return macro sheets; use the property or the property to return those sheets.

Example

This example displays the value in cell A1 on Sheet1 in the active workbook.

Visual Basic for Applications
MsgBox Worksheets("Sheet1").Range("A1").Value

This example displays the name of each worksheet in the active workbook.

Visual Basic for Applications
For Each ws In Worksheets MsgBox ws.Name Next ws

This example adds a new worksheet to the active workbook and then sets the name of the worksheet.

Visual Basic for Applications
Set newSheet = Worksheets.Add newSheet.Name = "current Budget"

See also: